首页 电脑 杀毒安全 查看内容

教你写杀毒脚本,自己清除Autorun病毒

2019-11-1 09:45 |来自: 互联网 1502 0

摘要: AutoRun本身是Windows系统的一种自动运行机制作,用于方便移动介质的使用,主要的原始意图是使用光盘时,当插入光盘即可自动运行光盘里的内容。但这一机制却被病毒利用,形成了一种Autorun类型病毒。在使用U盘、移动硬盘时,很容易感染这种病毒。病毒传播体的文件内容格式通常为:OPEN=AutoRun.exe:指 ...
关键词: AutoRun 病毒 driver sline 运行 fso sfile 光盘 盘根 自动

AutoRun本身是Windows系统的一种自动运行机制作,用于方便移动介质的使用,主要的原始意图是使用光盘时,当插入光盘即可自动运行光盘里的内容。

但这一机制却被病毒利用,形成了一种Autorun类型病毒。在使用U盘、移动硬盘时,很容易感染这种病毒。

病毒传播体的文件内容格式通常为:

OPEN=AutoRun.exe:指定设备启用时运行之命令行。
ICON=Autorun.ico:指定设备显示图标。

当把它保存为autorun.inf时,如果存在于U盘根目录,那么插U盘被插入电脑时,Autorun.exe就会运行。如果此处的Autorun.exe是病毒,那么相当于插入U盘,电脑自动就中病毒了。

下面是一段VBS脚本,把它保存行“杀Autorun病毒.vbs“(名称可以任意,后缀名需为.vbs),双击运行就可以杀灭这种病毒了。

这么有用的内容,快收藏起来吧!

option explicit
'copyleft by ShareWAF.com
'auther: WangLiwen
dim fso
dim drivers
dim driver
dim sfile
dim sline
dim svir
dim stemp
set fso=createobject("scripting.filesystemobject")
set drivers=createobject("scripting.filesystemobject").drives
for each driver in drivers
if fso.fileexists(driver &"autorun.inf") then
set sfile=fso.opentextfile(driver & "autorun.inf",1,true)
do while sfile.atendofstream<>true
sline=sfile.readline
if instr(1,ucase(sline),ucase(".exe")) then
svir=right(sline,len(sline)-instr(1,ucase(sline),"="))
if msgbox("发现autorun病毒:" & driver & "" & svir & vbcrlf & vbcrlf & "是否要清除?",vbyesno,"请确认")=vbyes then
if fso.fileexists(driver & "" & svir) then
fso.deletefile(driver & "" & svir)
end if
end if
end if
loop
sfile.close
fso.deletefile(driver & "autorun.inf")
end if
next
msgbox "检测完毕"
本文出处: https://www.toutiao.com/a6753857308477882894/
声明:文章版权归原作者所有 部分文章转自互联网 如有侵权请联系 [邮箱地址] 删除

路过

雷人

握手

鲜花

鸡蛋

最新评论

返回顶部