文章作者:xiaolu[BST]
信息来源:邪恶八进制信息安全团队(www.eviloctal.com)
这个不是exe2vbs所有类型的文件都可以转化的不过限于string的大小文件不能太大我测试过3m的文件是可以的
将下面的代码存为:file2vbs.vbs
复制代码 代码如下:
'ProgramByxiaolu
'name:file2vbs.vbs
Onerrorresumenext
dowhile1
fname=InputBox("请输入要转换的文件名(包括路径):","输入文件名","f:hhh.exe")
iffname=""thenWscript.quit
err.number=0
SetAdo=createObject("adodb.stream")
WithAdo
.Type=1
.open
.loadfromfilefname
ss=.read
EndWith
iferr.number<>0then
ifmsgbox("文件打开错误!",1,"File2VBS")=2thenWscript.quit
else
exitdo
endif
loop
fname=InputBox("请输入声成的vbs名(包括路径):","输入文件名","f:hhh.vbs")
iffname=""thenWscript.quit
SetFso=createObject("Scripting.FileSystemObject")
SetFile=fso.OpenTextFile(fname,2,True)
lens=lenB(ss)mod500
Forj=0toint(lenB(ss)/500)-1
ifj=0then
File.writeline"ss="""&Bin2Str(midb(ss,500*j+1,500))&"""_"
else
File.writeline"+"""&Bin2Str(midb(ss,500*j+1,500))&"""_"
endif
next
iflens>0then
File.writeline"+"""&Bin2Str(rightb(ss,lens))&""""
else
File.writeline"+"&chr(34)&chr(34)
endif
File.writeline""
File.writeline"SetRS=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"Sets=createObject(""ADODB.Stream""):withs:.Mode=3:.Type=1:.Open():.Writess:.SaveToFilewscript.arguments(0),2:endwith"
File.close
Setfso=nothing
Ado.close
setAbo=nothing
FunctionBin2Str(Re)
Fori=1TolenB(Re)
bt=AscB(MidB(Re,i,1))
ifbt<16ThenBin2Str=Bin2Str&"0"
Bin2Str=Bin2Str&Hex(bt)
Next
EndFunction
生成文件的办法
复制代码 代码如下:
cscriptfile2vbs.vbsc:test.exe