DDR爱好者之家 Design By 杰米
by zzzevazzz@ph4nt0m.org
用Base64编码数据,好处是压缩了大小(相对bin2str而言),缺点是增加处理时间和脚本复杂度。
由于效率瓶颈是在bat生成vbs这一步,所以总的来说还是合算了。
写文件用ADODB.Recordset,比debug好使多了。
大部分事都是脚本做的,批处理只是用echo来生成脚本而已。
echo版的好处是,全选复制粘贴到cmd shell里就把文件上传了。
复制代码 代码如下:
'Any2Bat.vbs by zzzEVAzzz
on error resume next
set arg=wscript.arguments
if arg.count=0 then wscript.quit
with CreateObject("ADODB.Stream")
.type=1:.open:.loadfromfile arg(0):bs=.read:l=.size:.close
end with
if err.number<>0 then wscript.quit
set fso=CreateObject("Scripting.FileSystemObject")
with fso.opentextfile(arg(0)&".bat",2,true)
if err.number<>0 then wscript.quit
.writeline "@echo bs=_>xx.vbs"
for k=1 to l step 129
.write "@echo """
.write b64b(midb(bs,k,129))
.writeline """+_xx.vbs"
next
.writeline "@echo """":set rs=CreateObject(""ADODB.Recordset"")xx.vbs"
.writeline "@echo set ado=CreateObject(""ADODB.Stream"")xx.vbs"
.writeline "@echo l=len(bs):ss="""":for k=1 to l step 4096:ss=ss+ub64(mid(bs,k,4096)):next:l=len(ss)xx.vbs"
.writeline "@echo rs.fields.append ""b"",205,l/2:rs.open:rs.addnew:rs(""b"")=ss+chrb(0):rs.updatexx.vbs"
.writeline "@echo ado.mode=3:ado.type=1:ado.open:ado.write rs(""b"").getchunk(l/2)xx.vbs"
.writeline "@echo ado.savetofile """+fso.getfilename(arg(0))+""",2:ado.closexx.vbs"
.writeline "@echo function ub64(s):dim t(4),b(3):ub64="""":n=len(s):r=2 xx.vbs"
.writeline "@echo if n mod 4^<^>0 then exit function:end if:for i=1 to n step 4:for j=0 to 3 xx.vbs"
.writeline "@echo a=asc(mid(s,i+j,1)):if a=43 then:a=62:else if a=47 then:a=63:else if a^>47 and a^<58 then:_xx.vbs"
.writeline "@echo a=a+4:else if a=61 then:a=0:if r=2 then r=j-2:end if:else if a^>64 and a^<91 then:_xx.vbs"
.writeline "@echo a=a-65:else if a^>96 and a^<123 then:a=a-71:else:exit function:_xx.vbs"
.writeline "@echo end if:end if:end if:end if:end if:end if:t(j)=a:nextxx.vbs"
.writeline "@echo b(0)=t(0)+t(1)*64 mod 256:b(1)=t(1)\4+t(2)*16 mod 256:b(2)=t(2)\16+t(3)*4 xx.vbs"
.writeline "@echo for j=0 to r:if b(j)^<16 then ub64=ub64+""0"":end if:ub64=ub64+hex(b(j))xx.vbs"
.writeline "@echo next:next:end functionxx.vbs&&cscript.exe //nologo xx.vbs&del xx.vbs"
end with
const b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
function b64b(bin)
b64b=""
n=lenb(bin)
for i=1 to n step 3
a=ascb(midb(bin,i,1))
b64b=b64b+mid(b64,a mod 64+1,1)
if i<n then
b=ascb(midb(bin,i+1,1))
b64b=b64b+mid(b64,(a\64+b*4)mod 64+1,1)
if i+1<n then
c=ascb(midb(bin,i+2,1))
b64b=b64b+mid(b64,(b\16+c*16)mod 64+1,1)
b64b=b64b+mid(b64,c\4+1,1)
else
b64b=b64b+mid(b64,b\16+1,1)
b64b=b64b+"="
end if
else
b64b=b64b+mid(b64,a\64+1,1)
b64b=b64b+"=="
end if
next
end function
用法很简单,就一个参数——要转换的文件全路径。
也可以直接拖放文件到这个vbs的图标上。
用Base64编码数据,好处是压缩了大小(相对bin2str而言),缺点是增加处理时间和脚本复杂度。
由于效率瓶颈是在bat生成vbs这一步,所以总的来说还是合算了。
写文件用ADODB.Recordset,比debug好使多了。
大部分事都是脚本做的,批处理只是用echo来生成脚本而已。
echo版的好处是,全选复制粘贴到cmd shell里就把文件上传了。
复制代码 代码如下:
'Any2Bat.vbs by zzzEVAzzz
on error resume next
set arg=wscript.arguments
if arg.count=0 then wscript.quit
with CreateObject("ADODB.Stream")
.type=1:.open:.loadfromfile arg(0):bs=.read:l=.size:.close
end with
if err.number<>0 then wscript.quit
set fso=CreateObject("Scripting.FileSystemObject")
with fso.opentextfile(arg(0)&".bat",2,true)
if err.number<>0 then wscript.quit
.writeline "@echo bs=_>xx.vbs"
for k=1 to l step 129
.write "@echo """
.write b64b(midb(bs,k,129))
.writeline """+_xx.vbs"
next
.writeline "@echo """":set rs=CreateObject(""ADODB.Recordset"")xx.vbs"
.writeline "@echo set ado=CreateObject(""ADODB.Stream"")xx.vbs"
.writeline "@echo l=len(bs):ss="""":for k=1 to l step 4096:ss=ss+ub64(mid(bs,k,4096)):next:l=len(ss)xx.vbs"
.writeline "@echo rs.fields.append ""b"",205,l/2:rs.open:rs.addnew:rs(""b"")=ss+chrb(0):rs.updatexx.vbs"
.writeline "@echo ado.mode=3:ado.type=1:ado.open:ado.write rs(""b"").getchunk(l/2)xx.vbs"
.writeline "@echo ado.savetofile """+fso.getfilename(arg(0))+""",2:ado.closexx.vbs"
.writeline "@echo function ub64(s):dim t(4),b(3):ub64="""":n=len(s):r=2 xx.vbs"
.writeline "@echo if n mod 4^<^>0 then exit function:end if:for i=1 to n step 4:for j=0 to 3 xx.vbs"
.writeline "@echo a=asc(mid(s,i+j,1)):if a=43 then:a=62:else if a=47 then:a=63:else if a^>47 and a^<58 then:_xx.vbs"
.writeline "@echo a=a+4:else if a=61 then:a=0:if r=2 then r=j-2:end if:else if a^>64 and a^<91 then:_xx.vbs"
.writeline "@echo a=a-65:else if a^>96 and a^<123 then:a=a-71:else:exit function:_xx.vbs"
.writeline "@echo end if:end if:end if:end if:end if:end if:t(j)=a:nextxx.vbs"
.writeline "@echo b(0)=t(0)+t(1)*64 mod 256:b(1)=t(1)\4+t(2)*16 mod 256:b(2)=t(2)\16+t(3)*4 xx.vbs"
.writeline "@echo for j=0 to r:if b(j)^<16 then ub64=ub64+""0"":end if:ub64=ub64+hex(b(j))xx.vbs"
.writeline "@echo next:next:end functionxx.vbs&&cscript.exe //nologo xx.vbs&del xx.vbs"
end with
const b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
function b64b(bin)
b64b=""
n=lenb(bin)
for i=1 to n step 3
a=ascb(midb(bin,i,1))
b64b=b64b+mid(b64,a mod 64+1,1)
if i<n then
b=ascb(midb(bin,i+1,1))
b64b=b64b+mid(b64,(a\64+b*4)mod 64+1,1)
if i+1<n then
c=ascb(midb(bin,i+2,1))
b64b=b64b+mid(b64,(b\16+c*16)mod 64+1,1)
b64b=b64b+mid(b64,c\4+1,1)
else
b64b=b64b+mid(b64,b\16+1,1)
b64b=b64b+"="
end if
else
b64b=b64b+mid(b64,a\64+1,1)
b64b=b64b+"=="
end if
next
end function
用法很简单,就一个参数——要转换的文件全路径。
也可以直接拖放文件到这个vbs的图标上。
DDR爱好者之家 Design By 杰米
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
DDR爱好者之家 Design By 杰米
暂无评论...
更新日志
2024年05月20日
2024年05月20日
- 张琍敏1978-雪中莲[台湾复刻版][WAV+CUE]
- 叶蕴仪1993-睡美人[日本版][WAV+CUE]
- 夜晚助兴音乐-群星《新时代床头音乐-性能量》2CD[WAV]
- 24K德国HD金碟《历届奥斯卡获奖金曲》3CD[WAV整轨]
- 邰正宵《重燃爱恋 贰 Walk On》[FLAC/分轨][431.72MB]
- 苏文劭《雨停出来走走》[320K/MP3][81.11MB]
- 苏文劭《雨停出来走走》[FLAC/分轨][210.76MB]
- 群星《2024好听新歌04》十倍音质WAV分轨
- 陈宁《弹指之间HQ》头版限量[低速原抓WAV+CUE]
- 陈宁《故人还》HQCDII限量签名版[低速原抓WAV+CUE]
- 苏文劭《春曲(Lessons)》[320K/MP3][39.8MB]
- 苏文劭《春曲(Lessons)》[FLAC/分轨][97.78MB]
- 群星《2006香港高级视听展原音精选 SACD》[ISO][2G]
- 张琍敏1977-枫林小雨[台湾复刻版][WAV+CUE]
- 林一峰2014-COOKINGMUSIC[香港首版][WAV+CUE]