⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 escape加密和unescape解密.txt

📁 s11ss写的批处理。他把很多C语言中经典的例子都用批处理实现了
💻 TXT
字号:
@echo off
::::::::Escape And Unescape {s11ss 2007-11-3}::::::::

::Instruction:
::1.For the limitation of the CMD,some codes such as "&" and other special codes can not be encrypted correctly.
::2.When you try to use the encrypted form to visit a website,please do not encrypt the words "http://".For instance,you would like to visit "http://www.cn-dos.net".You should do like this:
::%0 www.cn-dos.net
::Then you will get "%77%77%77%2E%63%6E%2D%64%6F%73%2E%6E%65%74",through which you can visit it.

::Receive arguments:
if "%1" equ "" (
        echo Two Arguments:
        echo 1. /e ^(escape^) or /u ^(unescape^)
        echo 2. a string
        echo e.g.:
        echo %0 /e www.cn-dos.net
        echo %0 /u %%77%%77%%77%%2E%%63%%6E%%2D%%64%%6F%%73%%2E%%6E%%65%%74
        echo.
        :Rec
        echo You can input arguments here too,like /e www.cn-dos.net: 
        call :GetArg
) else (set str1=%1&set str2=%2)
set str=%str2%
if "%str%" equ "" goto :Rec
if "%str1%" equ "/u" goto :Unescape

::Judge if run for the first time:
<"%~f0" more +130|find "::Data">nul&&goto :Escape||echo Run for the first time,please wait...

::Create a temporary file in which there is an ASCII value table:
>>%0 echo.
>>%0 echo.
>>%0 echo ::Data
set s= !"#$%%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
set/a n=0
:CreateFile
call set char="%%s:~%n%,1%%"
set/a n+=1,ascii=%n%+32
call :10to16 %ascii%
>>%0 echo %r% %char%
if not %n% equ 95 goto :CreateFile

::Encrypt codes one by one:
:Escape
echo Encrypting...
set/a num=0
call set o=%%str:~%num%,1%%
::The next two same statements define which code needs not to be encrypted:
::1.call :exception /
setlocal enabledelayedexpansion
        :ec1
        for /f "usebackq skip=131 delims=" %%a in (%0) do (
                set "v=%%a"
                if "%o%" equ "!v:~-2,1!" (
                        set ns=!ns!%%!v:~0,2!
                        goto :ec2
                )
        )
call :eChinese %o%
set/p x=<t
set ns=!ns!%x%
        :ec2
        set/a num+=1
        call set o=%%str:~%num%,1%%
::2.call :exception /
if not "%o%" equ "" goto :ec1

::Output the result:
echo.
echo Complete:
echo !ns!
goto :End

::Decrypt by javascript:
:Unescape
echo Decrypting...
mshta "javascript:t=unescape('%str%');f=new ActiveXObject('Scripting.FileSystemObject');f=f.CreateTextFile('t');f.Write(t);close()"
set/p str=<t
echo.
echo Complete:
echo %str%

:End
del t 2>nul
echo.
echo Press Any Key To Exit...
pause>nul
goto :eof








::Functions
:GetArg
set/p str=
for /f "tokens=1* delims= " %%a in ("%str%") do (set str1=%%a& set str2=%%b)
goto :eof

:10to16
set/a q=%1
        :1c
        set/a r=%q%%%16
        set/a q=%q%/16
        call set r=%%r:10=A%%
        call set r=%%r:11=B%%
        call set r=%%r:12=C%%
        call set r=%%r:13=D%%
        call set r=%%r:14=E%%
        call set r=%%r:15=F%%
        call set r%1=%r%%%r%1%%
if not %q% equ 0 goto :1c
call set r=%%r%1%%
set r%1=
goto :eof

:exception
if "%o%" equ "%1" (
        set ns=%ns%%1
        goto :ec2
)
goto :eof

:eChinese
mshta "javascript:t=escape('%1');f=new ActiveXObject('Scripting.FileSystemObject');f=f.CreateTextFile('t');f.Write(t);close()"
goto :eof

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -