/CAFED00D

Obfuscation resilent Java class reader/writer

Primary LanguageJavaMIT LicenseMIT

CAFEDOOD Build Status

Another class library with a focus on obfuscation support.

Features

  • Supports Oak classes
  • Drop malformed attributes from classes added by obfuscators

Usage

Add dependency

Add Jitpack to your repositories

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>
allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Add CafeDude dependency (where VERSION is the latest version)

<dependency>
    <groupId>com.github.Col-E</groupId>
    <artifactId>CAFED00D</artifactId>
    <version>VERSION</version>
</dependency>
implementation 'com.github.Col-E:CAFED00D:VERSION'

Reading and writing classes

The default settings have anti-obfuscation measures enabled.

// Reading
byte[] code = ...
ClassFileReader cr = new ClassFileReader();
// cr.setDropForwardVersioned(false) - enabled by default
// cr.setDropEofAttributes(false) - enabled by default
// cr.setDropDupeAnnotations(false) - enabled by default
ClassFile cf = cr.read(code);
// Writing
code = new ClassFileWriter().write(cf);

Stripping malformed attributes and data from classes

Additional items can be removed via:

// Modifies the 'cf' instance
new IllegalStrippingTransformer(cf).transform();