![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-09-15 12:23 |
47,812 topics / 349,917 posts / today 0 new / 48,268 members |
| DOS批处理 & 脚本技术(批处理室) » [Original] Text Encryption and Decryption Program (bat + debug) |
| Printable Version 17,527 / 23 |
| Floor1 qzwqzw | Posted 2007-05-30 15:42 |
| 银牌会员 Posts 636 Credits 2,343 | |
|
Last night someone posted a VB text encryption program
Using the Caesar cipher of adding 1 to each byte Soon our moderator brother made a VBS version Remembering that such simple text processing is more lightweight in assembly But I was hot and sleepy yesterday, so I didn't code it Today there was a moderate rain and it became much cooler Although I was nervous and busy But I still took the time to write it To prevent forgetting it when the weather gets hot again tomorrow ------------------------------------------------------- At first I planned to fully implement the +1/-1 cipher Later considering to benefit our lazy people I thought that XOR is simpler and more practical +1 is too easy to guess, I once broke the encrypted code after +1 of a certain bat2exe program The XOR algorithm is relatively harder to guess And encryption/decryption can reuse a module Originally wanted to support multi-bit keys So that it is more practical But unfortunately, whether +1 or +X or XOR X may get FF And FF cannot be output to standard output For the sake of simple code Still used the scheme of XOR with E0~EF So only the bytes from 10~1F may get FF And this area are control characters Rarely used in text files ------------------------------------------------------ Due to time constraints No special circumstances Not going to update it Those interested can study it by themselves [ Last edited by qzwqzw on 2007-6-5 at 12:09 PM ] |
|
| Floor2 starrysky | Posted 2007-05-30 16:12 |
| 新手上路 Posts 5 Credits 10 | |
|
Is this kind of program useful?
|
|
| Floor3 namejm | Posted 2007-05-30 16:20 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
|
First, a preliminary test was carried out, and the following two problems were discovered:
When the path contains spaces, there will be no result. The problem lies in the sentence "if exist _codec.com %comspec% /c_codec < %file% > %file%.txt". The relevant "%file%" statement should be enclosed in quotation marks; In addition, there is a logical problem in the first two pairs of if statements: when file or pass is not defined, default values are forcibly assigned to them, resulting in the fact that the latter two set /p statements have no chance to be executed at all. |
|
| Floor4 qzwqzw | Posted 2007-05-30 18:31 |
| 银牌会员 Posts 636 Credits 2,343 | |
|
Hi, said not to update
But there are really too many problems So had to release a new version To avoid leading people astray In addition, some details are modified and added Such as the default value for operating files For example, operation prompts and code comments |
|
| Floor5 namejm | Posted 2007-05-30 21:34 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
|
Hehe, it seems that brother qzwqzw wants to be lazy and doesn't plan to update anymore? Then I'll pick some more flaws:
1. The /s parameter is added to dir, which is bound to search in all subdirectories. If the specified file with the same name exists in the current directory and several subdirectories, the operation of the specified file will become difficult to control. It is suggested to not search subdirectories when searching for files; 2. The operation of adding quotes to the file path is incomplete, and there are still fish that slip through the net. For example, set file=%~dp0\*.txt. If there is & in this path, it will still go wrong. |
|
| Floor6 qzwqzw | Posted 2007-05-30 22:42 |
| 银牌会员 Posts 636 Credits 2,343 | |
|
Originally, the /s parameter was not added.
Later, it was found that when directly dragging the test file to the program, the current directory turned out to be %userprofile%. Then using ~ff would cause problems. So /s was added to get the full path. Now it seems that adding it is quite problematic. The issue with set file= Actually, you considered it meticulously. But there are too many such problems. I have already become tired of it. |
|
| Floor7 qzwqzw | Posted 2007-05-30 23:56 |
| 银牌会员 Posts 636 Credits 2,343 | |
|
Endure it for the sake of the person who gives extra points
The /s is removed, and the method of first obtaining the data file directory and then piecing together the path is changed set file has been changed as much as possible Anyone who is free can test it Drag and drop the data file to the program Drag and drop the data file to the command line window Enter the file path to the command line window The file path contains spaces The file path contains escape characters The file path is invalid |
|
| Floor8 namejm | Posted 2007-05-31 00:13 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
|
Hehe, I really found a problem, but it's still the old issue: not enclosing all paths in quotes - although the buddy is a bit tired of this problem, but I still have to mention it ^_^
The problem is in this line: set file=%1. When I handle the file te st.txt in the format of "*test.cmd" "te st.txt" in the CMD window... Hehe, you understand without me saying. It is suggested to change it to set "file=%~1". I haven't had time to test other things for the time being. |
|
| Floor9 qzwqzw | Posted 2007-05-31 00:45 |
| 银牌会员 Posts 636 Credits 2,343 | |
|
This problem has been modified.
By the way, the conditions for the appearance of the program logo have been modified. Also, a simple modification of the prompt. ------------------------------------------------------------------- Now I formally authorize this code to the China DOS Union. All members of the union can copy, modify and republish it. They can also use all or part of the code as part of their own code or project. Any project or code that uses this code must not violate the principle of free and open code. It cannot be used for any commercial or profit-making purposes. In short, it is released under a streamlined GPL agreement. That is to say, any further problems need you to modify them by yourselves. Absolutely a lazy person's agreement |
|
| Floor10 whswbiori | Posted 2007-08-01 04:46 |
| 新手上路 Posts 5 Credits 10 | |
|
Thanks for your sharing and testing. I'm a new user and think such an atmosphere is very good.
|
|
| Floor11 b102588 | Posted 2007-08-01 12:21 |
| 初级用户 Posts 34 Credits 83 | |
|
Well, I also think this place is good
|
|
| Floor12 ZJHJ | Posted 2007-08-03 07:36 |
| 高级用户 Posts 374 Credits 609 | |
|
I tried it initially, and the effect is good. It can also be encrypted multiple times. But it is not available for text programs (bat com).
|
|
| Floor13 vkill | Posted 2007-08-05 16:31 |
| 金牌会员 Posts 1,744 Credits 4,103 From 甘肃.临泽 | |
|
I can't understand debug, ai
|
|
| Floor14 knoppix7 | Posted 2007-08-06 10:00 |
| 银牌会员 Posts 634 Credits 1,287 From cmd.exe | |
|
I wrote something encrypted using the %XXXX:~X,X% method before... But... After encryption, it's 5 to 10 times larger than the original file...
|
|
| Floor15 xun0813 | Posted 2007-08-19 09:41 |
| 初级用户 Posts 8 Credits 20 | |
|
Almost all can't understand, who can explain the principle?
|
|
| 1 2 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |