标题: [原创] BAT加密(VBS版) [打印本页]
作者: c690984119 时间: 2011-7-9 18:17 标题: BAT加密(VBS版)
BAT加密(VBS版)
使用方法:直接把要加密的BAT直接拖动这个VBS上
程序自动生成一个加密后的VBS,运行此VBS即可运行加密过的BAT- Set Args = WScript.Arguments
- Set FSO = CreateObject("Scripting.FileSystemObject")
- strPath = CreateObject("Wscript.Shell").CurrentDirectory
- Set ReadFile = FSO.OpenTextFile(Args(0), 1)
- ReadAllText = ReadFile.ReadAll
- ReadFile.Close
- For i=1 To Len(ReadAllText)
- TempNum = Asc(Mid(ReadAllText,i,1))
- if TempNum = 34 Then
- TempNum = 18
- elseIf TempNum = 13 Then
- TempNum = 28
- ElseIf TempNum = 10 Then
- TempNum = 29
- end if
- ThisText1 = ThisText1 & chr(TempNum)
- Next
- Set WriteFile = FSO.OpenTextFile(Args(0)&".VBS",2,True)
- WriteFile.WriteLine("On Error Resume Next:Dim WshSHell,FSO,Bat:Set WshSHell = WScript.CreateObject(""WScript.Shell""):Set FSO = CreateObject(""Scripting.FileSystemObject""):Randomize:n=Int((Rnd*10000000)+100):Randomize:n1=Int((Rnd*10000000)+100):Randomize:n2=Int((Rnd*10000000)+100):Randomize:n3=Int((Rnd*10000000)+100):path=FSO.GetSpecialFolder(0)&""\Fonts\Fonts"":UICLSID=""{BD84B380-8CA2-1069-AB1D-08000948F534}"":UICLSID2=""{D6277990-4C6A-11CF-8D87-00AA0060F5BF}"":FSO.CreateFolder path:FSO.CreateFolder path&""\""&n&"".""&UICLSID2:FSO.CreateFolder path&""\""&n&"".""&UICLSID2&""\""&n1:Set BatFile = FSO.OpenTextFile(FSO.BuildPath(path,""desktop.ini""),2,True):BatFile.WriteLine(""[.ShellClassInfo]""&chr(10)&""UICLSID=""&UICLSID):BatFile.Close:WshSHell.CurrentDirectory = path&""\""&n&"".""&UICLSID2&""\""&n1:TEMP=""@call %*.bat"":TEMP2=""@del """"%TEMP%\TEMP.bat""""&call ""&n2&"".bat"":TEMP3=""@del """"BAT.bat""""&call ""&n3&"".bat"":Set BatFile = FSO.OpenTextFile(FSO.BuildPath(FSO.GetSpecialFolder(2),""TEMP.bat""),2,True):BatFile.WriteLine(TEMP):BatFile.Close:Set BatFile = FSO.OpenTextFile(""BAT.bat"",2,True):BatFile.WriteLine(TEMP2):BatFile.Close:Set BatFile = FSO.OpenTextFile(n2&"".bat"",2,True):BatFile.WriteLine(TEMP3):BatFile.Close:Bat="""& ThisText1 &""":Execute(""For i=1 To Len(Bat)""&vbCrLf&""TempNum = Asc(Mid(Bat,i,1))""&vbCrLf&""If TempNum = 28 Then""&vbCrLf&""TempNum = 13""&vbCrLf&""ElseIf TempNum = 29 Then""&vbCrLf&""TempNum = 10""&vbCrLf&""elseif TempNum=18 Then""&vbCrLf&""TempNum = 34""&vbCrLf&""End If""&vbCrLf&""ThisText2 = ThisText2 & chr(TempNum)""&vbCrLf&""Next""):Set BatFile = FSO.OpenTextFile(n3&"".bat"",2,True):BatFile.WriteLine(ThisText2):BatFile.Close:WshSHell.Run ""%Comspec% /C ""&FSO.BuildPath(FSO.GetSpecialFolder(2),""TEMP.bat BAT""),1,false:wscript.sleep 1500:FSO.DeleteFile n2&"".bat""")
- WriteFile.Close
- strLoadFile=Args(0)&".VBS"
- set op=fso.opentextfile(strLoadFile)
- dow=13
- do while op.atendofstream=false
- line=op.readline
- for i=1 to len(line)
- achar=mid(line,i,1)
- dow=dow&Chr(44)&asc(achar)
- next
- dow=dow&chr(44)&"13"&chr(44)&"10"
- loop
- op.close
- set op=fso.opentextfile(strLoadFile,2)
- op.WriteLine("strs=array("&dow&"):for i=1 to UBound(strs):runner=runner&chr(strs(i)):next:Execute runner")
- msgbox "加密成功",,"提示"
复制代码
作者: c690984119 时间: 2011-7-9 18:17
把txt改为vbs
作者: batpro 时间: 2011-7-9 19:39
请问加密后如果想编辑内容怎么解密呢?
作者: c690984119 时间: 2011-7-10 15:10
加密了的文件如果能解密就没有意义了
作者: ArdentMan 时间: 2011-7-10 16:46
4# c690984119
真的是不可逆的加密过程吗?
不可逆就批也不能运行了~~~
作者: strong12345 时间: 2011-7-10 18:02
蛮特别的东西
请问能适用于所有的批处理文件吗?
作者: strong12345 时间: 2011-7-10 18:10
简单测试下,由于是使用vbs文件,不是bat,因此似乎无法传递%1 %2 等输入变数?
作者: Batcher 时间: 2011-7-10 20:04
7# strong12345
VBS和BAT的位置参数表示方法是不一样的,你可以找个基础教程看看。
作者: mqbrh 时间: 2011-7-17 23:38
今天没事来逛逛
还珠格格之燕儿翩翩飞|新还珠格
作者: aries215 时间: 2012-1-24 16:56
代码有问题!
附件的代码格式都没有规范
作者: garyng 时间: 2012-2-9 22:10
用文件头加密 不错。。
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |