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

Time:2021-6-9

Bat file is easy to use, but its security is too fragile
Anyone can open it to view, or even modify its contents
Is there any way not to convert. Bat to. Exe or. Com, or. Bat file
But others can’t view and modify the content???
Is there any self encryption or something?
Master, give me a solution
The options currently under discussion are as follows:
1. Scheme of inserting Unicode character string in batch code
It is effective for programs such as Notepad that use the istextunicode function to identify encoding types
Invalid for programs such as type / edit / EDITPLUS / UltraEdit that do not use the istextunicode function

2. A scheme of adding Unicode byte order mark (BOM) to the header of batch code
       EncryBat.rar (zxcv) 

Effective for notepad, word, UltraEdit, type and other programs that support Unicode encoding
Invalid for programs that do not support Unicode encoding, such as edit / WinRAR internal viewer

3. The scheme of replacing carriage return with carriage return in batch code

It is effective for editors that recognize carriage return and line feed respectively, such as edit

4. Dictionary conversion scheme for batch code
Code plaintext is generated dynamically at runtime, so this scheme has nothing to do with the editor;
Bat file encryption  ( Better than bat2com (because it doesn’t support Chinese)
The method is as follows
Open notepad and write the beginning of the file to the following statement

Copy codeThe 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 %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%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 no encoding type is specified, it will use the default ANSI type (for the Chinese version, the corresponding is GB code).

        When opening a created document, it will analyze the coding type of the document. It first determines whether there is a BOM (byte) in the document header   Order   Mark, byte order mark, length of 2-3 bytes). If there is, the encoding type will be judged according to its content, such as FF, Fe (Unicode), Fe, FF (Unicode)   big   endian),EF、BB、BF(UTF-8)[1]。

        In fact, there are many non ANSI encoded documents that are “plain text” without any BOM, so these documents cannot be simply judged as ANSI encoded. But we need to use a series of statistical algorithms to guess the document code according to the document content. Notepad uses   IsTextUnicode   Function to determine whether it is   Unicode/Unicode   big   endian   Coding, using   IsTextUTF8   Judge whether it is   UTF8   code.

       But since it is a statistical algorithm, it is inevitable that there will be misjudgment, especially when the document content is too short, because the sample size is too small, the probability of such misjudgment will increase significantly. For example, the famous joke about Microsoft’s feud with Unicom is that when Notepad opens an ANSI encoded document with the word “Unicom”, istextutf8   The function misjudges it as utf8 code [2]; The same miscarriage of justice occurred in the United States   IsTextUnicode   Functions, such as  “ this   app   can   “Break”, a 4335 structure document, will be misjudged as “break”   Unicode   Code [3] [4].

       It should be noted that the possibility of this kind of misjudgment is based on the premise that the text is short and its byte characteristics are not disturbed. If the above text is slightly modified (even if only a carriage return is added), the misjudgment is difficult to happen again.

       and   yuanyong630   The particularity of this scheme lies in that its byte string is not only Unicode, but also 1288 bytes long. That is to say, it has strong Unicode characteristics, so it can resist the interference of some shorter non Unicode character strings, which is determined by the law of statistics. However, when the interference string is longer, the feature of Unicode will be significantly interfered until it is removed   IsTextUnicode   The function is assumed to be non-linear   Unicode。 Therefore, some friends are always unable to test successfully, which should be related to the length and content of the additional batch code. You can test the code in [5].

       Because other editors (such as   Word  /  Wordpad  /  EditPlus  /  UltraEdit) uses an updated encoding type determination algorithm, so in the   Unicode   There has been a lot of improvement in judgment, and   UTF8   My judgment is still unsatisfactory. But theoretically, there is no completely accurate algorithm, so we can only rely on avoiding using non ANSI documents without BOM, or manually specifying the encoding type when opening documents.

       In addition, if you use Notepad to save these files that misjudge the encoding type, it will be difficult to recover. If the error code is used to save, the original document will be marked with BOM, and the original document can no longer be observed by other editors. If used   ANSI   If the code is saved, the original document will be treated as   Unicode   The possibility of document being converted is close to zero.

[1]   Introduction to unicode
http://my.opera.com/neutronstar/blog/index.dml/tag/ code

[2]   Why Microsoft and Unicom have a grudge
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 will   0d   0a   Change to   0a   It is better to change it to   0d  。 That is to say, if the carriage return line feed is changed to carriage return line feed only, the text of the current line will be covered by the text line without line feed, and the overlapping will be repeated. If you add a comment text with a length greater than all of the above lines to the last line of the batch, only this comment will eventually be displayed.  

       This method is effective for edit and type, so it was once popular in DOS era. However, this scheme is similar to yuanyong630’s scheme, but it is a specific text processing mechanism for a specific text processor and cannot be applied to all platform environments.  

       As for other encryption methods, each has its own defects. It is difficult to meet the requirements of software engineering
Bat encryption tool.rar      EncryBat.rar