Veil is an obfuscator for JAVA applications.

Developers

Social Media

Legal

Home


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.

Bytecode Obfuscation Workbench

Standard Browser Edition: Loading...
Obfuscation Preset
Target JAR File
Execution Edition Standard Browser Edition

Name Obfuscation
Packages that keep their names, separated by commas:
Access Reduction
Varargs Conversion
Parameter Type Widening
Method Parameter Changes
extra parameters that carry keys and decoys.
Name Prefix a prefix every new name starts with.
Alphabet the characters the new names are built from.
Name Policy
Package Collapse every class moves into one package.
Helper Placement off mixes them into the program.
Package Access off widens the access instead of moving classes together.
String Encryption
how the literals are hidden; Enhanced encrypts them with DES.
Constant Encryption
Program Rebuild
Reference Obfuscation
Dynamic Invocation
Reflective Access
Flow Obfuscation
Light adds dead branches, Aggressive flattens the body.
Exception Obfuscation
Heavy moves the handlers into a method of their own.
Exception Type Concealment
Optimization
Debug Info Removal
Line Number Obfuscation
Local Variables refines Debug Info Removal; takes effect only when it is on.
Method Parameters
Line Number Table a stack trace of a kept table still points at the source line.
Inner Class Table
Kept Attributes
Exemptions One glob per line. An exempt class keeps its name and is not moved, rebuilt or flow-rewritten; an exempt file keeps its path.
Loader Metadata Rewriting The file keeps its path and the class names inside it move with the rename.
Format Lists One entry per line. Leave blank for the engine default.
Decoy Class Injection realistic decoy classes added to the JAR file (0 to 500).
Filler Class Injection synthetic filler classes added to the JAR file (0 to 500).
Helper Package the helper classes of the run move here; blank mixes them into the program.
Failure Path Hardening
Integrity Checking
Expiry days until the application refuses to launch (leave blank for none).
Native Compilation
The library is built for every system that is picked, so the JAR file runs on all of them.

Stack Trace Retrace

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

Example: one method, three stages

Veil Obfuscator and its runtime are proprietary. Do not reverse engineer them. See License.

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

JAR Benchmark (Maximum Native)

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.

org.lwjgl.demo.opengl.raytracing.VoxelLightmapping2
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.