![]() |
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-23 03:30 |
47,812 topics / 349,917 posts / today 0 new / 48,273 members |
| DOS批处理 & 脚本技术(批处理室) » [Original] [Discussion] Non-compiled Batch Processing Encryption Scheme and Code |
| Printable Version 118,416 / 364 |
| Floor16 chenall | Posted 2006-07-21 17:23 |
| 银牌会员 Posts 469 Credits 1,276 From 福建泉州 | |
|
The 7th floor is impressive. I'm not sure about the principle, but you can view it using the DOS TYPE command. Just avoid opening it with Windows Notepad.
It seems there isn't currently a software that can effectively encrypt .BAT files. Tools like QuickBFC.EXE merely package the BAT file; when run, they first extract the BAT file to a directory and then execute it. |
|
| Floor17 electronixtar | Posted 2006-07-21 21:46 |
| 铂金会员 Posts 2,672 Credits 7,493 | |
|
I don't understand the code in the 7th floor.
There seems to be a way to trick children: change the 0D 0A line breaks in the bat file to 0A, which may cause some trouble in reading. |
|
| Floor18 yuanyong630 | Posted 2006-07-22 01:18 |
| 初级用户 Posts 13 Credits 49 | |
|
To restore an encrypted file, use Notepad and change the encoding format to "UTF-8" when saving. However, it is best to create a backup before encryption, as restoration may sometimes fail. Finally, thank you all for your support.
|
|
| Floor19 bagpipe | Posted 2006-07-22 08:54 |
| 银牌会员 Posts 425 Credits 1,144 From 北京 | |
|
The code on the 7th floor really does work for encryption. I don't know how it works; I can't figure it out, but I still want to give it a thumbs up. Impressive!
May I ask the 7th floor: Did you come up with this code yourself, or did you see it somewhere else? If you created it yourself, please explain the working principle. If you saw it elsewhere, that's fine. Thank you. [ Last edited by bagpipe on 2006-7-22 at 08:55 ] |
|
| Floor20 yuanyong630 | Posted 2006-07-22 11:03 |
| 初级用户 Posts 13 Credits 49 | |
|
I can confirm that this method was not found elsewhere. In fact, I discovered this encryption technique quite by accident. As for the principle behind it, I suspect it is a bug in Windows, similar to how typing the word "联通" (without quotes) in Notepad and saving the file results in garbled text. You can try it to verify.
|
|
| Floor21 fastslz | Posted 2006-07-22 12:47 |
| 铂金会员 Posts 2,315 Credits 5,493 From 上海 | |
|
Why is the method on the 7th floor a one-time use? Does it not work the second time?
|
|
| Floor22 SXBG | Posted 2006-07-22 16:08 |
| 初级用户 Posts 25 Credits 62 | |
|
Extend the index and middle fingers, separate them slightly at an angle of approximately 20 degrees, then insert, insert, insert... attacking the opponent's eyeballs^_^
|
|
| Floor23 yuanyong630 | Posted 2006-07-23 07:39 |
| 初级用户 Posts 13 Credits 49 | |
|
The solution is to copy and paste the following code until the "encryption" result is successfully achieved. Everyone can try it! Thank you for your support!
for /l %%a in (1,1,10) do ren *.jpg %%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 %%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 |
|
| Floor24 namejm | Posted 2006-07-23 10:35 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
|
Based on yuanyong630's description on the 18th floor, it seems that changing the encoding when saving the bat file in Notepad was used to achieve confidentiality. Why have none of my attempts succeeded? The system is XP+SP2.
|
|
| Floor25 willsort | Posted 2006-07-23 12:15 |
| 元老会员 Posts 1,512 Credits 4,432 | |
|
Re namejm & others:
Regarding Brother yuanyong630's encryption scheme, your思路 is correct, but there are slight deviations. When the Notepad program saves a newly created document without a specified encoding type, it uses the default ANSI type (for the Chinese version, this corresponds to GB encoding). When opening an existing document, it analyzes the document's encoding type. First, it checks for a BOM (Byte Order Mark, a 2-3 byte sequence) at the beginning of the document. If present, it determines the encoding type based on the content: FF FE (Unicode), FE FF (Unicode big endian), EF BB BF (UTF-8). Since many non-ANSI encoded documents are "plain text" without any BOM, such documents cannot be simply judged as ANSI encoded. Instead, a series of statistical algorithms are used to guess the document encoding based on the content. Notepad uses the IsTextUnicode function to determine if the encoding is Unicode/Unicode big endian and IsTextUTF8 to check for UTF8 encoding. However, as these are statistical algorithms, misjudgments are inevitable, especially when the document content is too short. Due to the small sample size, the probability of such misjudgments increases significantly. For example, the well-known joke about Microsoft having a grudge against China Unicom arises because Notepad misidentifies an ANSI encoded document containing only the two characters "联通" as UTF8 using the IsTextUTF8 function. Similar misjudgments occur with the IsTextUnicode function; for instance, a document with the structure "this app can break" (4335 structure) is misidentified as Unicode encoding. It should be noted that such misjudgments are likely only when the text is short and its byte characteristics are not disturbed. If the text is slightly modified (even by adding a single carriage return), misjudgment becomes difficult. The uniqueness of Brother yuanyong630's scheme lies in its byte string, which not only has Unicode characteristics but is also long, reaching 1288 bytes. This means its Unicode characteristics are strong, allowing it to resist interference from some short, non-Unicode characteristic strings, as determined by statistical laws. However, when the interfering string is somewhat longer, the Unicode characteristics will be significantly disrupted until the IsTextUnicode function identifies it as non-Unicode. Therefore, some friends who cannot successfully test it should consider the length and content of the additional batch processing code. Everyone can test the code in . Other editors (such as Word/Wordpad/EditPlus/UltraEdit) use newer encoding determination algorithms, which have improved Unicode judgment, though UTF8 judgment remains unsatisfactory. Theoretically, a completely accurate algorithm does not exist, so we can only avoid using non-ANSI documents without BOM or manually specify the encoding type when opening documents. Additionally, if Notepad is used to save files with misjudged encoding types, recovery becomes difficult. Saving with the misjudged encoding adds a BOM mark, making the original document unobservable in other editors. Saving with ANSI encoding converts the original document as if it were Unicode, leaving almost no possibility of restoration. Unicode Introduction http://my.opera.com/neutronstar/blog/index.dml/tag/编码 Why Does Microsoft Have a Grudge Against China Unicom http://blog.vckbase.com/localvar/archive/2005/07/12/9510.aspx Notepad bug? Encoding issue? http://weblogs.asp.net/cumpsd/archive/2004/02/27/81098.aspx Bush Hid The Facts http://www.shoutwire.com/comments/16341/Bush_Hid_The_Facts cry.cmd |
|
| Floor26 willsort | Posted 2006-07-23 12:27 |
| 元老会员 Posts 1,512 Credits 4,432 | |
|
Re electronixtar(17):
Regarding the method of changing 0d 0a to 0a, it might be better to change it to 0d instead. That is, changing carriage return and line feed to only carriage return without line feed; then the text of the current line will be overwritten by the text line without line feed, and such overwriting and superimposition will repeat. If a comment text longer than all the above lines is added at the last line of the batch file, only such a comment will be displayed in the end. This method is effective for EDIT and TYPE, so it was once popular during the DOS era. However, this solution is similar to Brother yuanyong630's solution; it only targets the specific text processing mechanism of specific text processors and cannot be applied to all platform environments. As for other encryption methods, each has its own flaws, and it is relatively difficult to meet the requirements of software engineering. |
|
| Floor27 pengfei | Posted 2006-07-23 13:24 |
| 银牌会员 Posts 485 Credits 1,218 From 湖南.娄底 | |
|
First, thank you to yuanyong630 for providing the encryption code; I only used it to write this tool to facilitate everyone's use.
I have fixed the flaw in renaming image files as pointed out by the moderator, and now a total of four encryption methods are provided. [ Last edited by pengfei on 2006-10-2 at 09:12 ] Attachments BAT加密工具.rar (978 bytes) |
|
| Floor28 IceCrack | Posted 2006-07-23 13:43 |
| 中级用户 Posts 168 Credits 332 From 天涯 | |
|
Testing was unsuccessful on my end. Whether using method one or method two, the following code was added before my code:
for /l %%a in (1,1,10) do ren *.jpg %%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 %%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 |
|
| Floor29 zh159 | Posted 2006-07-23 13:58 |
| 金牌会员 Posts 1,467 Credits 3,687 | |
|
I tried it and found that only those starting with "@echo off" on the first line can be encrypted successfully, but not all of them. After encryption, opening it with Notepad shows garbled characters, but it can still be executed.
[ Last edited by zxcv on 2006-7-23 at 14:01 ] |
|
| Floor30 pengfei | Posted 2006-07-23 14:03 |
| 银牌会员 Posts 485 Credits 1,218 From 湖南.娄底 | |
|
'lkj;l
[ Last edited by pengfei on 2007-1-22 at 10:43 AM ] |
|
| Prev 1 2 3 4 5 … 25 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |