Obfuscate a compiled JAVA file in your browser. The JAR file stays on your machine. Each run renames members, encrypts strings and numbers, and hardens the control flow, so decompiled code is harder to read, reverse engineer and deobfuscate. The aim is to raise the cost of cracking at minimal runtime cost. This is a design goal, not a guarantee: a determined analyst can still study a running program.
Paste an obfuscated stack trace and load the mappings file from the run that produced the JAR file. The original classes, methods and line numbers come back. It runs in your browser; the mappings file stays on your machine.
| Mappings File | |
|---|---|
| Obfuscated Stack Trace |
1. Original source
public String readFile(final File file) throws Exception {
if(file == null)
throw new Exception("file is null");
if(!file.exists())
throw new FileNotFoundException();
FileReader fileReader = null;
BufferedReader bufferedReader = null;
try {
fileReader = new FileReader(file);
bufferedReader = new BufferedReader(fileReader);
final StringBuilder builder = new StringBuilder();
String line;
while((line = bufferedReader.readLine()) != null)
builder.append(line).append('\n');
return builder.toString();
} catch(final Exception e) {
e.printStackTrace();
} finally {
try {
if(fileReader != null)
fileReader.close();
if(bufferedReader != null)
bufferedReader.close();
} catch(final Exception ignored) { }
}
return "error";
}
2. Obfuscated source, recovered from the class file
static String a0(File var0, int var1, Object ... var2) throws Throwable {
int var3 = var1 ^ (a.k[0] ^ 0x4A1F9C23);
if(var0 == null) {
throw (Throwable)Lookup.c(0, a.s[var3 & 3]);
}
if(((Boolean)Lookup.m(1, var0)).booleanValue() == ((var3 | 1) == 0)) {
throw (Throwable)Lookup.c(2);
}
Object var4 = null;
Object var5 = null;
label208: {
try {
var4 = Lookup.c(3, var0);
var5 = Lookup.c(4, var4);
Object var6 = Lookup.c(5);
if((var3 ^ var3) != (a.k[1] - a.k[1])) {
throw null;
}
String var7;
while((var7 = (String)Lookup.m(6, var5)) != null) {
Lookup.m(7, Lookup.m(8, var6, var7), (char)((var1 ^ 0x7F3A) & 0xFF));
}
return (String)Lookup.m(9, var6);
} catch (Throwable var18) {
break label208;
} finally {
if(var4 != null) Lookup.m(10, var4);
if(var5 != null) Lookup.m(10, var5);
}
}
return a.s[(var3 >>> 4) & 1];
}
3. Native compilation, recovered from the class file and disassembled
Recovered Class File (Java bytecode body removed):
public final class a {
static {
Loader.loadNative("/<path>/<library>.so");
}
public static native String a0(File var0, int var1, Object ... var2) throws Throwable;
}
Disassembled Native Library (libveil.so compiled via LLVM):
Java_a_a0:
55 push rbp
48 89 e5 mov rbp, rsp
41 57 41 56 53 push r15 ; push r14 ; push rbx
48 89 fb mov rbx, rdi
48 85 d2 test rdx, rdx
0f 84 b4 00 00 00 je .Lthrow_null_file
48 8b 03 mov rax, qword ptr [rbx]
ff 90 18 01 00 00 call qword ptr [rax + 0x118]
...
The demos of the LWJGL graphics library, unobfuscated and obfuscated at the maximum native preset. Each
download carries the libraries of the demo, so it starts with java -jar.
| JAR File | Download the unobfuscated JAR file |
|---|---|
| JAR File at maximum native | Download the obfuscated JAR file |
| How it was made | Obfuscated and compiled to native machine code for every system at the maximum native preset (the program rebuilt, and the passes that keep a method as bytecode turned off so most of it becomes machine code), engine build cd57c274b38c4eb0. |