Bat file encryption bat decryption script

Time:2020-1-14

Bat encryption script(save as. Bat file)

@echo off
cls
color 2a
:start
cls
echo *******************************************************************************
echo * *
Echo * bat encryption final*
echo * *
echo *******************************************************************************
echo.
echo.
The final version of echo bat encryption is the updated version of “bat encryption tool”, which has many advantages over the previous version of encryption tool:
echo.
Echo can encrypt any batch file successfully at one time, which is more convenient
echo.
Echo ★ you can input any batch that needs to be encrypted, which makes encryption more flexible
echo.
Echo can automatically judge the wrong input, which is more humanized
echo.
Echo Description: enter the batch file to be encrypted below. Directly enter the batch file name to encrypt the bat in the current directory, or specify any bat with path. The encrypt.bat file generated in the current directory is the encrypted batch
echo.
Echo Author: Mu Linsen QQ: 573381312 bye
echo.
echo.
echo.
Set / P file = please input the batch to be encrypted and press enter (q = exit):
if “%file%”==”q” goto quit
echo %file%|findstr /i “\.bat$”>nul && goto go
echo %file%|findstr /i “\.cmd$”>nul && goto go
cls
echo ==============
Echo please input correctly!
echo ==============
echo.
echo.
Echo press any key to re-enter
pause>nul
goto start
:go
if not exist “%file%” goto newly
if exist encrypt.bat copy encrypt.bat encryptbak.bat
echo %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a >”%tmp%\encrypt.tmp”
echo cls>>”%tmp%\encrypt.tmp”
type “%file%”>>”%tmp%\encrypt.tmp”
setlocal enabledelayedexpansion
for %%i in (“%tmp%\encrypt.tmp”) do (
echo %%~zi >nul 2>nul
set size=%%~zi
set num=!size:~-1!
set /a mod=!num!%%2
if !mod! equ 0 (goto even) else (goto odd)
)
:even
copy “%tmp%\encrypt.tmp” encrypt.bat
del “%tmp%\encrypt.tmp”
cls
echo ==========================
Echo congratulations, batch encryption succeeded ^ ^ ^!
echo ==========================
echo.
echo.
Echo press any key to exit
pause>nul
goto quit
:odd
echo. >>”%tmp%\encrypt.tmp”
copy “%tmp%\encrypt.tmp” encrypt.bat
del “%tmp%\encrypt.tmp”
cls
echo ==========================
Echo congratulations, batch encryption succeeded ^ ^ ^!
echo ==========================
echo.
echo.
Echo press any key to exit
pause>nul
goto quit
:newly
cls
echo ================================
Echo can’t find the batch file, please re-enter!
echo ================================
echo.
echo.
Echo press any key to start
pause>nul
goto start
:quit
exit

BAT decryption(save as. Bat file)

@echo off
mode con: cols=80 lines=25
:index
color 27
cls
echo ╭──────────── ──╮
echo │ │
Echo ╭╭╭╭╭╭╭├├├├├├├╮╮╮╮╮╮╮
echo │ │ │ │
echo │ ╰────────── ────╯ │
echo │ │
echo │ │
Echo │ this tool is used to decrypt the encrypted batch processing of obfuscated text encoding type
echo │ │
Echo │ fill in the batch to be decrypted below and press enter
echo │ │
Echo │ it is recommended to directly drag the batch file to be decrypted to this window for release
echo │ │
Echo │ after successful decryption, “new” file name to be decrypted. File suffix “will be generated in this program directory │
Echo │ file format │
echo │ │
Echo │ note: if there is a file with “new” to be decrypted. File suffix “in this directory, │
Echo │ will be replaced
echo │ │
echo │ │
echo ╰─── ─────────────────────────────╯
echo.
set route=%cd%
set ravel=
Set / P travel = please enter the batch to decrypt:
set “ravel=%ravel:”=%”
if /i “%ravel:~-4%”==”.bat” if exist “%ravel%” goto go
if /i “%ravel:~-4%”==”.cmd” if exist “%ravel%” goto go
cls
echo ╭──────────╮
Echo ╭╭╭╭╭╭├├├├├╮╮╮╮╮╮╮╮╮
echo │ ╰──────────╯ │
echo │ │
Echo │ specifies that the file does not exist or is not a batch type! │
echo │ │
Echo │ press any key to re-enter… │
echo │ │
echo ╰───────────────── ───────────╯
echo.
echo.
Echo press any key to re-enter
pause >nul
goto index

:go
for /f “tokens=*” %%c in (“%ravel%”) do (
cd /d “%%~dpc”
if exist “%route%\new_%%~nxc” attrib -s -h -r -a “%route%\new_%%~nxc”
echo author:[email protected]>”%route%\new_%%~nxc”
for /f “tokens=*” %%i in (%%~nxc) do (
echo %%i>>”%route%\new_%%~nxc”
)
)
cls
echo ╭──────────╮
Echo ╭╭╭╭╭╭╭├├├├├╮╮╮╮╮╮╮╮
echo │ ╰──────────╯ │
echo │ │
Echo │ congratulations, batch decryption succeeded! │
echo │ │
echo ╰──────────────────── ────────╯
echo.
echo.
Echo press any key to exit
pause >nul
exit