China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-21 09:18
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Original] [Discussion] Non-compiled Batch Processing Encryption Scheme and Code DigestI View 110,353 Replies 364
Floor 76 Posted 2006-08-05 14:28 ·  中国 广西 玉林 博白县 电信
金牌会员
★★★★
Credits 3,687
Posts 1,467
Joined 2005-08-08 12:00
20-year member
UID 44210
Status Offline
This encryption method is the same as "copy/b a.txt+the file to be encrypted.bat encrypted.bat". Analyze and convert it through the file name of the third sentence to the "copy/b a.txt+the file to be encrypted.bat encrypted.bat" encryption method. If convenient, post your BAT for me to see. The several files I tried are normal.
Floor 77 Posted 2006-08-08 05:46 ·  中国 山东 威海 联通
初级用户
Credits 37
Posts 18
Joined 2006-05-13 16:28
20-year member
UID 55456
Status Offline
Experts! I salute you!
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
+1 2008-12-11 00:37
Floor 78 Posted 2006-08-30 23:10 ·  中国 湖南 娄底 电信
银牌会员
★★★
Credits 1,218
Posts 485
Joined 2006-07-21 21:24
19-year member
UID 58987
From 湖南.娄底
Status Offline
I was quite busy some time ago, so I didn't post replies all the time. Today I had time and wrote the final version of BAT encryption.

While everyone was discussing intensely, I discovered the limitations of brother yuanyong630's encryption code during repeated testing. I used to think it was sensitive to certain characters, but later I realized it's actually sensitive to the parity of the file byte size. When the number of bytes is odd, encryption doesn't succeed; only even numbers can be encrypted.

So I improved this encryption tool, hoping everyone will like it~

Thanks to brother namejm for helping improve this tool!^_^

[ Last edited by pengfei on 2006-10-3 at 10:00 ]
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
+1 2008-12-11 00:39
Attachments
BAT加密最终版.rar (995 bytes, Credits to download 1 pts, Downloads: 468)
Floor 79 Posted 2006-08-30 23:19 ·  中国 湖南 娄底 电信
银牌会员
★★★
Credits 1,218
Posts 485
Joined 2006-07-21 21:24
19-year member
UID 58987
From 湖南.娄底
Status Offline
@echo off
color 27
:start
cls
echo *******************************************************************************
echo * *
echo * BAT 加 密 最 终 版 *
echo * *
echo *******************************************************************************
echo.
echo.
echo The final version of BAT encryption is an updated version of the "BAT Encryption Tool", which has many advantages over the previous encryption tool:
echo.
echo ★ Can successfully encrypt any batch processing file at one time, which is more convenient.
echo.
echo ★ You can input any batch processing that needs to be encrypted, and the encryption flexibility is greater.
echo.
echo ★ Can automatically judge wrong input, which is more humanized.
echo.
echo Description: Enter the batch processing file that needs to be encrypted below. Directly enter the batch processing file name to encrypt the BAT in the current directory, or you can specify any BAT with a path. The encrypt.bat file generated in the current directory is the encrypted batch processing.
echo.
echo Author: Mulinsen QQ:573381312 BYE
echo.
echo.
echo.
set /p file=Please enter the batch processing that needs to be encrypted and press Enter (q=Quit):
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 enter 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 processing encryption is successful^^!
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 processing encryption is successful^^!
echo ==========================
echo.
echo.
echo Press any key to exit......
pause>nul
goto quit
:newly
cls
echo ================================
echo Batch processing file not found, please re-enter!
echo ================================
echo.
echo.
echo Press any key to start......
pause>nul
goto start
:quit
exit

[ Last edited by pengfei on 2006-9-3 at 01:24 ]
Floor 80 Posted 2006-08-31 00:34 ·  中国 四川 成都 鹏博士宽带
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
Not bad, the functionality is relatively powerful, worthy of praise ^_^.

I took a rough look at the code, and there are still many places worth improving: for example, the sentence echo "%file%" | find /i ".bat" && goto go will misjudge non-batch files containing .bat in the file name, the sentence echo %%~zi >nul 2>nul is optional, and pause >nul 2>nul can be simplified to pause>nul, etc... Hehe, brother still needs to keep working hard, make some improvements in checking for omissions, humanization, conciseness, beauty, etc., and strive to make this tool a masterpiece in the forum.
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
plp626 +1 2007-12-15 11:13
尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。
Floor 81 Posted 2006-09-19 11:32 ·  中国 广东 广州 越秀区 电信
中级用户
★★
Credits 259
Posts 112
Joined 2006-09-18 04:55
19-year member
UID 62928
Gender Male
Status Offline
It turns out that after discussing for so long, it's because it's sensitive to the parity of the file byte size. Hehe. It seems that XP still has quite a few bugs! ~~~
Floor 82 Posted 2006-10-05 04:59 ·  中国 湖南 娄底 电信
银牌会员
★★★
Credits 1,218
Posts 485
Joined 2006-07-21 21:24
19-year member
UID 58987
From 湖南.娄底
Status Offline
Mid-Autumn Festival is here. Have you all eaten mooncakes? Hehe~ If you have, send some to me.

I'm releasing a batch processing decryption tool as a Mid-Autumn Festival gift for everyone. It works for the encryption schemes of Brother yuanyong630 on and Brother zxcv on ~~~!

This is what I discovered when writing the encryption code (for extracting text lines is not restricted by the encoding type). Especially Brother zxcv's encryption scheme. If the code is in Chinese, edit will display garbled text, then everyone gets confused and hurries to find garbled text viewers, hex editors to view the source code.

Hehe~ Just drag the mouse here and press enter to solve it...


@echo off
mode con: cols=80 lines=25
:index
color 27
cls
echo ╭───────────────╮
echo │ │
echo ╭─────────┤ BAT 解 密 工 具 ├─────────╮
echo │ │ │ │
echo │ ╰───────────────╯ │
echo │ │
echo │ │
echo │ This tool is used to decrypt encrypted batch processing with obfuscated text encoding types! │
echo │ │
echo │ Fill in the batch processing that needs to be decrypted below and press Enter. │
echo │ │
echo │ It is recommended to directly drag and drop the batch processing file to be decrypted into this window to release. │
echo │ │
echo │ After successful decryption, a file in the format "new_original file name.file extension" will be generated in the directory of this program │
echo │ Format file. │
echo │ │
echo │ Note: If a file with "new_original file name.file extension" exists in this directory, │
echo │ It will be replaced. │
echo │ │
echo │ │
echo ╰───────────────────────────────────╯
echo.
set route=%cd%
set ravel=
set /p ravel= Please enter the batch processing to be decrypted:
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 ╭─────────┤ File Error ├────────╮
echo │ ╰──────────╯ │
echo │ │
echo │ The specified file does not exist or the file is not of batch processing 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:pengfei@www.cn-dos.net>"%route%\new_%%~nxc"
for /f "tokens=*" %%i in (%%~nxc) do (
echo %%i>>"%route%\new_%%~nxc"
)
)
cls
echo ╭──────────╮
echo ╭─────────┤ Decryption Successful ├────────╮
echo │ ╰──────────╯ │
echo │ │
echo │ Congratulations, batch processing decryption successful! │
echo │ │
echo ╰─────────────────────────────╯
echo.
echo.
echo Press any key to exit...
pause >nul
exit



[ Last edited by pengfei on 2006-10-6 at 10:22 ]
Attachments
BAT解密工具.rar (901 bytes, Credits to download 1 pts, Downloads: 333)
Floor 83 Posted 2006-10-05 05:44 ·  中国 四川 成都 教育网
铂金会员
★★★★
Credits 7,493
Posts 2,672
Joined 2005-09-02 00:00
20-year member
UID 42173
Gender Male
Status Offline
Bat decryption tool:

copy con xxx.bat

Everyone has a happy Mid-Autumn Festival ~~

[ Last edited by electronixtar on 2006-10-5 at 05:45 ]

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>"
Floor 84 Posted 2006-10-05 06:06 ·  中国 广东 佛山 广东睿江科技有限公司
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
Hehe, it turns out that just a for loop can do it. I really didn't expect it to be so simple.
尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。
Floor 85 Posted 2006-10-07 04:09 ·  中国 广东 云浮 电信
荣誉版主
★★★
Credits 718
Posts 313
Joined 2005-09-26 00:00
20-year member
UID 42844
Gender Male
Status Offline
Classic! Very delicious filling...
Floor 86 Posted 2006-10-13 19:41 ·  中国 江苏 苏州 吴江区 电信
初级用户
Credits 141
Posts 22
Joined 2004-06-07 00:00
22-year member
UID 26188
Gender Male
Status Offline
I use the browser to open it and it shows plain text.
Floor 87 Posted 2006-10-16 00:52 ·  IANA 局域网IP(Private-Use)
中级用户
★★
蝴蝶之吻
Credits 430
Posts 177
Joined 2006-09-20 12:00
19-year member
UID 63170
From 广东深圳
Status Offline
If I change the extension to something else (.DOC/.TRF, etc.), I can see the plain text!!!
Floor 88 Posted 2006-10-16 01:17 ·  中国 四川 成都 移动
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
Actually, as long as you open it with the ASCII encoding format, you can see the plain text. Because Word comes with several kinds of encodings, and there is US-ASCII encoding among them. Hehe, it seems that Word is a relatively good garbled code viewer.
尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。
Floor 89 Posted 2006-10-16 01:37 ·  中国 黑龙江 牡丹江 中移铁通
初级用户
Credits 71
Posts 34
Joined 2006-09-15 02:15
19-year member
UID 62611
Status Offline
"Unicom" becomes garbled code, how did you find it. Really a smart person.

In fact, as long as you enter characters with the "ear" radical combined with "tong" it's all garbled code!!!!!

Such as "zhitong"!!

[ Last edited by yiping1973 on 2006-10-16 at 01:41 ]
Floor 90 Posted 2006-10-19 03:12 ·  中国 浙江 宁波 电信
初级用户
Credits 44
Posts 15
Joined 2006-10-18 12:14
19-year member
UID 66379
Status Offline
How to open it with tools like C32ASM binary and see the source code.
‹ Prev 1 4 5 6 7 8 25 Next ›
Forum Jump: