You can convert a file to a VBS code for a VBS statement _VBS

Source: Internet
Author: User
Article author: xiaolu [BST]
Source of information: Evil Octal Information Security team (www.eviloctal.com)

This is not exe2vbs all types of files can be converted, but limited to string size files cannot be too big I tested 3m files is OK
Save the following code as: File2vbs.vbs
Copy Code code as follows:

' Program by Xiaolu
' Name:file2vbs.vbs
On Error Resume Next
Do While 1
Fname=inputbox ("Enter file name (including path) to convert:", "Enter filename", "F:\hhh.exe")
If Fname= "" then Wscript.Quit
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
Fname=inputbox ("Please enter the sound of the VBS name (including the path):", "Input filename", "F:\hhh.vbs")
If Fname= "" then Wscript.Quit
Set fso=createobject ("Scripting.FileSystemObject")
Set File=fso. OpenTextFile (fname,2, True)
LENS=LENB (ss) MoD 500
for j=0 to Int (LenB (ss)/500)-1
If J=0 Then
File.writeline "ss=" "&bin2str (MidB (ss,500*j+1,500)) &" "_"
Else
File.writeline "+" "" &bin2str (MidB (ss,500*j+1,500)) & "" _ "
End If
Next
If Lens>0 Then
File.writeline "+" "" &bin2str (RIGHTB (ss,lens)) & "" "
Else
File.writeline "+" &AMP;CHR (&AMP;CHR) (34)
End If
File.writeline ""
File.writeline "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) "
File.writeline "Set s=createobject (" "ADODB). Stream ""): With S:. Mode = 3:. Type = 1:. Open ():. Write SS:. SaveToFile wscript.arguments (0), 2:end with "
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

ways to generate files
Copy Code code as follows:

cscript File2vbs.vbs C:\test.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.