What is BlackObfuscator
jar2dex-2.2dex2jar.repository·jar2dex-2.2·Indexed 22 days ago
https://github.com/codinggay/blackobfuscatorA DEX control flow obfuscator for Android APKs based on a modified version of dex2jar. It increases decompilation difficulty without altering application logic. The tool provides a CLI for processing .dex files with configurable obfuscation depth, input/output paths, and rule-based filtering for specific classes or packages. Additional integrations include an Android Studio plugin and a GUI tool.
dex2jar.You can run the obfuscator using the Main#main entry point. The tool accepts several command-line arguments to control the depth, input/output paths, rules, and target packages.
BlackObfuscatorCmd.main("d2j-black-obfuscator",
"-d", "2",
"-i", "/Users/milk/Documents/classes.dex",
"-o", "/Users/milk/Documents/classes_out.dex",
"-a", "filter.txt");BlackObfuscator provides two alternative ways to use the tool:
For automated workflows or non-command-line usage, separate tools are available:
You can run the obfuscator programmatically or via the command line using the Main#main method. You must provide the input DexFile, the output path, and configuration parameters such as obfuscation depth and rules.
BlackObfuscatorCmd.main("d2j-black-obfuscator",
"-d", "2",
"-i", "/Users/milk/Documents/classes.dex",
"-o", "/Users/milk/Documents/classes_out.dex",
"-a", "filter.txt");Obfuscation rules are defined in a text file (passed via the -a flag) to specify which classes or packages should be obfuscated or excluded.
Supported syntax:
# prefix: Comments (e.g., #it is annotation or #class).package_name: Obfuscates the specified package.class_name: Obfuscates the specified class.!package_name: A blacklist entry. Packages or classes prefixed with ! will not be obfuscated.#it is annotation
#cn.kaicity
#class
cn.kaicity.gk.cdk.BuildConfig
#package
cn.kaicity
#blackList
!cn.kaicity.gk.cdkThe following flags are used when invoking the Main#main method:
| Flag | Description |
|---|---|
-d | Obfuscation depth (higher values result in deeper obfuscation) |
-i | Path to the input .dex file |
-o | Path for the output .dex file |
-a | Path to the rules/filter file |
-p | Package name(s) that require obfuscation |
-d | Obfuscation depth
-i | Input dex path
-o | Output dex path
-a | Rules file
-p | Package name to obfuscateWhen invoking the obfuscator, use the following flags to configure the process:
| Parameter | Description |
|---|---|
-d | Obfuscation depth (higher numbers increase code complexity) |
-i | Path to the input DexFile |
-o | Path where the obfuscated DexFile will be saved |
-a | Path to the rules/filter file |
-p | Specific packages that need to be obfuscated |
-d | Obfuscation depth
-i | DexFile path
-o | Output path
-a | Rules file path
-p | The packages which need to be obfuscatedBlackObfuscator can be invoked via a command line interface to perform DEX control flow obfuscation. The core logic is driven by the BlackObfuscatorCmd class.
Key arguments include:
-d: Specifies the obfuscation level (e.g., 2).-i: The input path to the .dex file you wish to obfuscate.-o: The output path where the obfuscated .dex file will be saved.-a: The path to an obfuscation rule/filter file (e.g., filter.txt).d2j-black-obfuscator -d 2 -i /path/to/input.dex -o /path/to/output.dex -a filter.txt