Bat encryption tool encrybat non-compiled bat batch encryption scheme and code

Source: Internet
Author: User
Tags ultraedit

Although the BAT file is easy to use, its security is too fragile.
Anyone can open and view or even modify the content.
Is there any handler that fails to convert .batto. .exe or. com, or is still a. BAT file?
But others cannot view and modify the content ???
Is there anything like self-encryption?
Let's give you a solution.
The current solution is as follows:
1. Batch Processing Code How to insert Unicode feature strings
Use the istextunicode function for notepad and other functions to identify encoding types Program Valid
It is invalid for programs that do not use the istextunicode function, such as type/edit/editplus/ultraedit.

2. Add Unicode bytecode mark (BOM) to the batch processing code Header
Encrybat.rar (zxcv)

Valid for Unicode-encoded programs such as Notepad, word, ultraedit, and type.
Invalid for programs that do not support Unicode encoding such as Edit/WinRAR internal Viewer

3. solution to replace the carriage return or line break of the batch code with the carriage return

The editor that identifies line breaks for edit and so on separately

4. Code Conversion Scheme for Batch Processing
The code is dynamically generated when it is run in plain text, so the solution has nothing to do with the editor;
BAT file encryption method (better than the bat2com software <because the software does not support Chinese)
The method is:
Open notepad and write the following statement at the beginning of the file Copy code The Code is as follows: 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 % %

When the Notepad program saves a new document, if the encoding type is not specified, the default ANSI Type is used (for the Chinese version, the corresponding GB code is used ).

When you open a created document, it analyzes the encoding type of the document. It first determines whether the document header contains BOM (byte order mark, byte order mark, Length: 2 ~ 3 bytes), if any, the encoding type is determined based on its content, FF, Fe (UNICODE), Fe, FF (UNICODE big endian), EF, BB, BF (UTF-8) [1].

In fact, many non-ANSI-encoded documents do not have any Bom "plain text", so these documents cannot be simply judged as ANSI-encoded. However, a series of statistics are required.AlgorithmGuess the document encoding based on the document content. Notepad uses the istextunicode function to determine whether it is Unicode/Unicode big endian encoding, and istextutf8 to determine whether it is utf8 encoding.

However, since it is a statistical algorithm, it is inevitable that there will be misjudgment, especially when the content of the document is too short, because the sample size is too small, the probability of such misjudgment will increase significantly. For example, the famous joke between Microsoft and China Unicom is that when notepad opens an ANSI encoded document with only the word "China Unicom", the istextutf8 function misjudges it as utf8 encoding [2]; the same misjudgment also occurs on the istextunicode function. For example, a 4335-structure document with "this app can break" may be misjudged as Unicode encoding [3] [4].

It should be noted that this possibility of misjudgment is based on the premise that the text is short and Its byte features are not disturbed. If you make a slight modification to the above text (even if you only add a carriage return), it is difficult to make a false positive.

The special feature of yuanyong630's scheme is that its byte string not only has Unicode characteristics, but also reaches 1288 bytes. That is to say, its Unicode features are very strong, therefore, it can resist the interference of some shorter UNICODE character strings, which is determined by the statistical rule. However, when the interference string is a little longer, Unicode features will be significantly disturbed until they are identified as non-Unicode by the istextunicode function. Therefore, some friends may not be able to test successfully. It should be related to the length and content of the additional batch processing code. You can test the code in [5.

Because other editors (such as Word/WordPad/editplus/ultraedit) use the updated encoding type judgment algorithm, the Unicode judgment has been improved a lot, while the utf8 judgment is still unsatisfactory. However, in theory, completely accurate algorithms do not exist, so we can only avoid using non-ANSI documents without Bom, or manually specify the encoding type when opening a document.

In addition, if you use NotePad to save these files that misjudge the encoding type, it will be difficult to recover. If the file is saved with a wrong code, the BOM mark will be added to the original document, and the original document will no longer be observed using other editors. If it is saved using ANSI encoding, the original document will be converted as a unicode document, and the possibility of restoration is close to zero.

[1] Unicode Introduction
Http://my.opera.com/neutronstar/blog/index.dmltag/encoding

[2] Why does Microsoft hate China Unicom?
Http://blog.vckbase.com/localvar/archive/2005/07/12/9510.aspx

[3] notepad bug? Encoding issue?
Http://weblogs.asp.net/cumpsd/archive/2004/02/27/81098.aspx

[4] Bush hid the facts
Http://www.shoutwire.com/comments/16341/Bush_Hid_The_Facts

[5] Cry. cmd
For the method to change 0d 0a to 0a, it is better to change it to 0d. The text of the current line will be overwritten by lines without line breaks. If you add a comment text with a length greater than the preceding lines to the last row of the batch processing, the comment will only be displayed.

This method is effective for edit and type, so it was once popular in the DOS era. However, this scheme is similar to that of yuanyong630, but it only targets specific text processing mechanisms of specific text processors and cannot be applied to all platform environments.

As for other encryption methods, they also have their own shortcomings. It is difficult to meet the requirements of software engineering ..
Batencryption tool .rar encrybat.rar

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.