欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

VBS脚本加密/解密VBS脚本(简易免杀版1.1)

程序员文章站 2022-04-29 09:18:26
dim wshshell,fso on error resume next set wshshell =&nbs...
dim wshshell,fso
on error resume next
set wshshell = wscript.createobject("wscript.shell")
set fso = createobject("scripting.filesystemobject")
set args = wscript.arguments
ver="1.1"
closetime = 5
filename = wscript.scriptname
filefullname = wscript.scriptfullname
filepath = fso.getparentfoldername(filefullname)
inspath = fso.getspecialfolder(1)
insfullname = fso.buildpath(inspath ,filename)
copyright="废铁"
qq="qq:415736"
email="email:415736@163.com"
institle="加密/解密vbs脚本(简易免杀版)"&ver
insanswer="加密/解密vbs脚本(简易免杀版)"&ver
regpath1="hkey_classes_root\vbsfile\shell\encode_vbs\"
regvalue1="加密/解密vbs脚本"&ver
regform1="reg_sz"
regpath2="hkey_classes_root\vbsfile\shell\encode_vbs\command\"
regvalue2="wscript.exe " & chr(34) & insfullname & chr(34) & " " & chr(34) & "%l" & chr(34)
regpath3="hkey_classes_root\vbsfile\shell\encode_vbs\encode_very"
regvalue3="0"
regvalue4="1"
if filefullname <> insfullname then
intanswer = msgbox("【是】将“"+ insanswer +"”加入到右键菜单,"&chr(10)&chr(10)&"【否】将“
"+ insanswer +"”从右键菜单删除。 ", vbquestion + vbyesnocancel, "安装 - "+ institle +" - "+ 
copyright)
    if intanswer = vbyes then
wshshell.regwrite regpath1,regvalue1,regform1
wshshell.regwrite regpath2,regvalue2,regform1
wshshell.regwrite regpath3,regvalue4,regform1
fso.getfile(filefullname).copy(insfullname)
wshshell.popup _
"添加脚本文件:"+chr(10)+insfullname+chr(10)+chr(10)+ _
"添加注册表项:"+chr(10)+chr(34)+ regpath1 +chr(34)+chr(10)+ _
chr(10) & closetime & " 秒钟后本窗口将自动关闭!" +chr(10)+chr(10)+ _
chr(10) & "copyright(c)  " + copyright +"   " & qq &"   " + email _
, closetime, "安装成功 - "+ institle +" - "+ copyright, 0 + 64
end if
        if intanswer = vbno then
wshshell.regdelete regpath3
wshshell.regdelete regpath2
wshshell.regdelete regpath1
fso.deletefile insfullname
wshshell.popup _
"删除脚本文件:"+chr(10)+insfullname+chr(10)+chr(10)+ _
"删除注册表项:"+chr(10)+chr(34)+ regpath1 +chr(34)+chr(10)+ _
chr(10) & closetime & " 秒钟后本窗口将自动关闭!" +chr(10)+chr(10)+ _
chr(10) & "copyright(c)  " + copyright +"   " & qq &"   " + email _
, closetime, "卸载成功 - "+ institle +" - "+ copyright, 0 + 64
end if
else
package = wscript.arguments.item(0)
pkgname=fso.getbasename(package)
pkgpath=fso.getparentfoldername(package)
set readfile = fso.opentextfile(package, 1)
readalltextfile=readfile.readall
if left(readalltextfile,10)<>"rem encode" then
encodepanduan="rem encode-easy by qq:415736"
codestring=readalltextfile
for i=1 to len(codestring)
tempnum = asc(mid(codestring,i,1))
if tempnum = 13 then
tempnum = 28
elseif tempnum = 10 then
tempnum = 29
elseif tempnum=34 then
tempnum = 18
elseif tempnum>96 and tempnum<110 then
tempnum=tempnum+13
elseif tempnum>109 and tempnum<123 then
tempnum=tempnum-13
elseif tempnum>47 and tempnum<53 then
tempnum=tempnum+5
elseif tempnum>52 and tempnum<58 then
tempnum=tempnum-5
end if
thistext = thistext & chr(tempnum)
next
call encodefile
else
call uncodefile
end if
end if
set wshshell = nothing
set fso = nothing
set args = nothing
wscript.quit(0)
sub encodefile()
set newfile = fso.createtextfile(fso.buildpath(pkgpath ,pkgname&"_encode.vbs"), true)
newfile.writeline(encodepanduan)
newfile.writeline("exestring="&chr(34)&thistext&chr(34))
newfile.writeline("execute("&chr(34)&"for i=1 to len(exestring)"&chr(34)&"&vbcrlf&"&chr(34)
&"tempnum = asc(mid(exestring,i,1))"&chr(34)&"&vbcrlf&"&chr(34)&"if tempnum = 28 then"&chr
(34)&"&vbcrlf&"&chr(34)&"tempnum = 13"&chr(34)&"&vbcrlf&"&chr(34)&"elseif tempnum = 29 
then"&chr(34)&"&vbcrlf&"&chr(34)&"tempnum = 10"&chr(34)&"&vbcrlf&"&chr(34)&"elseif 
tempnum=18 then"&chr(34)&"&vbcrlf&"&chr(34)&"tempnum = 34"&chr(34)&"&vbcrlf&"&chr(34)
&"elseif tempnum>96 and tempnum<110 then"&chr(34)&"&vbcrlf&"&chr(34)
&"tempnum=tempnum+13"&chr(34)&"&vbcrlf&"&chr(34)&"elseif tempnum>109 and tempnum<123 
then"&chr(34)&"&vbcrlf&"&chr(34)&"tempnum=tempnum-13"&chr(34)&"&vbcrlf&"&chr(34)&"elseif 
tempnum>47 and tempnum<53 then"&chr(34)&"&vbcrlf&"&chr(34)&"tempnum=tempnum+5"&chr(34)
&"&vbcrlf&"&chr(34)&"elseif tempnum>52 and tempnum<58 then"&chr(34)&"&vbcrlf&"&chr(34)
&"tempnum=tempnum-5"&chr(34)&"&vbcrlf&"&chr(34)&"end if"&chr(34)&"&vbcrlf&"&chr(34)
&"thistext = thistext & chr(tempnum)"&chr(34)&"&vbcrlf&"&chr(34)&"next"&chr(34)&")")
newfile.writeline("execute(thistext)")
newfile.close
wshshell.popup chr(10) &_
"加密成功了!保存为文件:"+ chr(10) &chr(10) & _
fso.buildpath(pkgpath ,pkgname&"_encode.vbs")+chr(10)+chr(10)+ _
chr(10) & closetime & " 秒钟后本窗口将自动关闭!" +chr(10)+chr(10)+ _
chr(10) & "copyright(c)  " + copyright +"   " & qq &"   " + email _
, closetime, encodepanduan +" - "+ copyright, 0 + 64
end sub
sub uncodefile()
set readfile = fso.opentextfile(package, 1)
readlinetextfile1=readfile.readline
readlinetextfile2=readfile.readline
readlinetextfile3=readfile.readline
readfile.close
set newfile = fso.createtextfile(fso.buildpath(pkgpath ,pkgname&"_uncode.vbs"), true)
newfile.writeline(readlinetextfile2)
newfile.writeline(readlinetextfile3)
newfile.writeline("encodepanduan="&chr(34)&readlinetextfile1&chr(34)&vbcrlf&"encodepd="&chr
(34)&"rem encode-very by qq:415736"&chr(34)&vbcrlf&"for i=1 to len
(thistext)"&vbcrlf&"tempnum = asc(mid(thistext,i,1))"&vbcrlf&"tempchar = chr
(tempnum)"&vbcrlf&"if encodepanduan=encodepd then"&vbcrlf&"if tempchar = chr(58) 
then"&vbcrlf&"tempchar = chr(13)"&vbcrlf&"end if"&vbcrlf&"end if"&vbcrlf&"thistexttem = 
thistexttem & tempchar"&vbcrlf&"next")
newfile.writeline("strcode = (thistexttem)"&vbcrlf&"set wshshell = wscript.createobject
("&chr(34)&"wscript.shell"&chr(34)&")"&vbcrlf&"set fso = createobject("&chr(34)
&"scripting.filesystemobject"&chr(34)&")"&vbcrlf&"filename = 
wscript.scriptname"&vbcrlf&"set fc = fso.opentextfile(filename, 2, true)"&vbcrlf&"fc.write 
strcode"&vbcrlf&"fc.close"&vbcrlf&"set wshshell = nothing"&vbcrlf&"set fso = 
nothing"&vbcrlf&"wscript.quit(0)")
newfile.close
wscript.sleep 1500
wshshell.run (chr(34)&fso.buildpath(pkgpath ,pkgname&"_uncode.vbs")&chr(34)), vbhide
wshshell.popup chr(10) &_
"解密成功了!保存为文件:"+ chr(10) &chr(10) & _
fso.buildpath(pkgpath ,pkgname&"_uncode.vbs")+chr(10)+chr(10)+ _
chr(10) & closetime & " 秒钟后本窗口将自动关闭!" +chr(10)+chr(10)+ _
chr(10) & "copyright(c)  " + copyright +"   " & qq &"   " + email _
, closetime, "解密成功 - "+ institle +" - "+ copyright, 0 + 64
end sub