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 "+" &CHR (&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&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