Source Code

The plugin is distributed with full C# source code. To build the plugin from the source code, you need the following:

  • Visual Studio 2022 or greater

  • The latest release of Babel Obfuscator Enterprise or Company editions

Build Instructions

Open the Visual Studio solution file, Babel.BabelEncrypt.sln and build the project. The plugin project references babel.exe from the Babel install folder, typically C:\Program Files\Babel. If the babel.exe reference is not found, please remove the reference and add babel.exe from your local Babel Obfuscator install folder.

Changing the Code

If you plan to modify the source code, this resource provides a quick reference and helpful tips to ease your entry and ensure a smooth start.

Source Files

The Encrypt Plugin project contains the following files.

EncryptPlugin.cs

This file contains the EncryptPlugin class that implements the Babel plugin interface. The plugin registers the string encryption service class used by Babel Obfuscator to encrypt strings. The arguments passed at the babel command line are processed here when the plugin is initialized.

StringEncrypter.cs

The StringEncrypter class provides the string encryption service. It contains code for integrating the decrypter with the obfuscation target and implements the encryption methods for XOR and HASH algorithms. The Encrypt(...) method serves as the entry point, called by Babel Obfuscator during the string encryption phase, where the string is then processed by the XOR or HASH encrypter. Upon completion of the encryption phase, the Terminate() method is invoked to store the encrypted data within the target. The embedded decryption code will retrieve the encrypted data in the obfuscated target at runtime.

StringDecrypter.cs

This file contains all the decryption logic that will be merged with the target assembly. As the classes inside this file are to be compiled and merged during the execution of the plugin, this file is compiled as an Embedded Resource of the DLL plugin.

To temporarily check the code syntax or make any code changes, you can switch the Build Action from Embedded Resource to Compile. After making all the changes, you can switch back to Embedded Resource and start debugging your changes.

Debugging the Plugin

To debug the plugin, open Babel.BabelEncrypt project properties, select the Debug property page and create a new profile. Then set the following configuration:

Executable

C:\Program Files\Babel\babel.exe

Command line arguments

MyApp.exe @ -v5 --stringencrypt custom --plugin BabelEncrypt.dll

Where MyApp.exe is the target assembly that will be obfuscated using the plugin.

Last updated