Today we introduce an open source. NET Obfuscation--confuserex
http://yck1509.github.io/ConfuserEx/
Due to the use of. NET obfuscation in the project, there are many online searches, such as Dotfuscator, Xeoncode, Foxit and so on.
But most of the charges, of course, there are cracked version of the company requirements can not use pirated software.
Find a half-day finally found Confuserex, use up also line, hurriedly take out to everyone to share under.
: https://github.com/yck1509/ConfuserEx/releases
As the online introduction of Chinese relatively few, I do a test here, to show you:
1, a new C # class library, I will not change the name, it is called ClassLibrary1 Bar, under the Class1.cs class to add a simple method:
public class Class1 {public string test () { return "2"; } }
2. Then create a console application Consoletest, add reference to the test method in the Classlibrary1.dll,main method called Classlibrary1.class1:
static void Main (string[] args) { Classlibrary1.class1 c = new Classlibrary1.class1 (); Console.WriteLine (C.test ()); Console.ReadLine (); }
After compiling, open ConsoleTest.exe with Ilspy, no doubt, you can see the source code, such as:
3, now let's try to confuse Confuserex with:
Download Confuserex after unpacking, open ConfuserEx.exe, such as:
4, see the hint "Drag input modules here"?
Then put the ConsoleTest.exe in it, such as:
5. Click Settings
(1) Select Packer
(2) Modules->consoletest.exe
(3) Rules Click + Sign, True
Such as:
6. Click protest!->protect! , prompting for successful export (under the confused directory),
7, open with Ilspy ... \confused under the ConsoleTest.exe, look at the source:
The method is empty, copy the ConsoleTest.exe dependent ClassLibrary1.dll to the confused directory, click Run ConsoleTest.exe, and output the correct result.
Attention
8, if only to confuse the EXE file, so that you can, if just confuse a DLL file, you will see the following error:
Error: No executable module, no actuator?
Is there no exe file? We put ConsoleTest.exe in and ClassLibrary1.dll together to see.
9, according to the previous way, I put ConsoleTest.exe, ClassLibrary1.dll are dragged into the Confuserex together confused,
Such as:
Prompt succeeds.
10, but we open again ... \confused, found only the confused ConsoleTest.exe file, where did ClassLibrary1.dll run?
Isn't it possible to confuse DLL files?
Don't worry, we click ConsoleTest.exe try, oops, I went, unexpectedly run successfully, such as:
The only explanation here is that Confuserex embedded the DLL inside the EXE.
Now the confused ConsoleTest.exe is 17KB, and the original ConsoleTest.exe is 5kb,classlibrary1.dll is also 5KB.
11, we then use Ilspy to see at the same time confusion ConsoleTest.exe and ClassLibrary1.dll generated after the ConsoleTest.exe,
The method body is not visible and the referenced DLL file is not visible.
All right, here we go today.
add : Due to the noon did not find a separate method to confuse the DLL, the afternoon @ cents's home This classmate found the method, I am here to attach on how to confuse the DLL separately.
According to the 8th step, we found that according to EXE's way to confuse the DLL times wrong, originally should follow the following steps:
After dragging the DLL into the Confuserex, settings cannot choose Packer, but to click the Pencil button on the right, such as.
Click the Pencil button, pop up the Edit Rule dialog, preset Select an item, I choose Maximum here, and then click the "+" button below, select Anti ildasm (I guess to prevent the compilation by IL), and then export successfully.
We are using Ilspy to look at the newly confused ClassLibrary1.dll, for example,
I can't see anything.
In order to test the obfuscated DLLs available, I put the ConsoleTest.exe and confused ClassLibrary1.dll in a directory, click Run ConsoleTest.exe, success.
PostScript: When confusing DLLs, there are many confusing rules that we can confuse in our own way. Actually those rules are what, I do not know, the heart of the classmate to try.
Thanks again for @ cents's home.
Open source. NET Obfuscation Confuserex Introduction