C # Use dotfuscator to confuse code and Encryption

Source: Internet
Author: User
Tags printable characters

C # compiledCodeIf obfuscation and encryption are not performed to a certain extent, it is very easy to be decompiled for cracking, especially for some commercial C # software, because there are many people staring at it, it is easy to crack. Dotfuscator can be used to implement obfuscation code, variable name modification, string encryption, and other functions.

Here is the introduction of dotfuscatorpro_4.9.7750_2.0 version, there is a need to search online download https://skydrive.live.com /? Cid = d2b31627abf128d8 & id = d2b31627abf128d8 % 21104. Install dotfuscator to open the interface. You can configure options, input, rename, string encryption, and build. The following describes the default settings.

 

 

 

Settings-> Global OptionsThis is the global configuration option:

Set disable string encryption to no, that is, enable string encryption. Check whether disable control flow and dsiable renaming are no, that is, ensure that the control flow and obfuscation functions are enabled. For example:

 

In the input OptionSelect the DLL and exe files that need to be obfuscated and encrypted. Do not select libraries. Otherwise, some classes and variables will not be obfuscated;

Rename OptionCheck "use enhanced overload induction". Note: Do not select "Do not suppress on serializable types" below, that is, variables of the serialization type are not encrypted, otherwise, an exception may occur after compilation. For "Renaming Scheme", select "unprintable" (non-printable characters, I .e. garbled characters). You can also select other methods such as lower-case letters, upper-case characters, and numbers. For example:

 

String encryption optionSelect the project files EXE and DLL that require string encryption in include.

 

Settings->Build settings optionsSet the output target folder and click the button above to regenerate the new EXE and DLL files.

 

Now let's take a look at the effect of encryption obfuscation:

 

Original code:

Using system;
Using system. Collections. Generic;
Using system. LINQ;
Using system. text;

Namespace consoleapplication1
{
Class Program
{
Static readonly int A = B * 10;
Static readonly int B = 10;
// Const int A = B * 10;
// Const int B = 10;

Public static void main (string [] ARGs)
{
Person P = new person ();
Console. writeline ("A is {0}, B is {1}", a, B );
}
}

Public class person
{
Static int age;
}

}

After dotfuscator obfuscation and encryption, we use the famousDecompilation software ReflectorYou can see that the code in the function body is invisible, the string is also garbled, and the function name is invisible, as shown below:

 

Notes for obfuscation using dotfuscator]:
1. If your encrypted DLL and exe have public classes and need to be referenced externally, the DLL and EXE that reference the public should be put together in dotfuscator input, obfuscation encryption is performed at the same time. Otherwise, an error occurs in external calls.
2. If there is a public class, but you do not want to follow the method of, you can check the library mode (expand project in input, see), or do not select the rename option, only use control flow for obfuscation (class name and function name are displayed in this mode, but the function body is not seen ).

3. If there is a public class, but you do not want to follow the method of my first and second points, you can exclude these public class names, method names, and attribute names in the rename option: exclude items on the left side of rename exclude, or use the regular expression exclusion method on the right side, as shown in:

Of course, the software world cannot be cracked, but the use of dotfuscator obfuscation and encryption can at least block many new users!

Author: flymorn
Source: flymorn
Copyright. The author and original source and this statement must be indicated in the form of links during reprinting.

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.