BlackObfuscator Documentation

repository·jar2dex-2.2·Indexed 22 days ago

https://github.com/codinggay/blackobfuscator

A 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.

Tokens
1.3K
Snippets
6
Records
10
Agent score
67%

What's inside BlackObfuscator

  1. What is BlackObfuscator

    jar2dex-2.2
    BlackObfuscator is a tool designed for DEX control flow obfuscation in Android APKs. It modifies the original code to make it difficult to read and increases the difficulty of decompilation without changing the application's original logic. It is built upon modifications to dex2jar.
  2. Best Practices and Precautions

    jar2dex-2.2
    To avoid issues during the conversion process, it is highly recommended to only obfuscate your own business logic code. Avoid obfuscating third-party libraries. Use the obfuscation rules file to provide specific paths to your business code and blacklist third-party packages.
  3. Use BlackObfuscator via CLI

    jar2dex-2.2

    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");
  4. Use BlackObfuscator via Command Line

    jar2dex-2.2

    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");
  5. Configure Obfuscation Rules

    jar2dex-2.2

    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.cdk
  6. CLI Arguments Reference

    jar2dex-2.2

    The following flags are used when invoking the Main#main method:

    FlagDescription
    -dObfuscation depth (higher values result in deeper obfuscation)
    -iPath to the input .dex file
    -oPath for the output .dex file
    -aPath to the rules/filter file
    -pPackage name(s) that require obfuscation
    -d | Obfuscation depth
    -i | Input dex path
    -o | Output dex path
    -a | Rules file
    -p | Package name to obfuscate
  7. Reference CLI parameters for BlackObfuscatorCmd.main

    jar2dex-2.2

    When invoking the obfuscator, use the following flags to configure the process:

    ParameterDescription
    -dObfuscation depth (higher numbers increase code complexity)
    -iPath to the input DexFile
    -oPath where the obfuscated DexFile will be saved
    -aPath to the rules/filter file
    -pSpecific 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 obfuscated
  8. Use the BlackObfuscator CLI via command line arguments

    jar2dex-2.2

    BlackObfuscator 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