Branchlock Features

Branchlock provides a number of features that prevent reverse engineering and bytecode editing.

Control Flow Obfuscation LIGHTWEIGHT

Changes the programs code flow which leads to hardly readable code, causes decompilers unable to find suitable flow graphs.

Before

    public static KeyStroke getAccelerator(String string) {
        String string2 = Util.isMacOS() ? "meta " : "control ";
        return KeyStroke.getKeyStroke(string2 + string);
    }
            
After

    public static KeyStroke getAccelerator(String var0) {
        v0 = Util.isMacOS() ? 1 : 0;
        if (v0 == 0) {
            v0 % v0;
            v0 = 0;
        }
        var1_1 = "meta ";
        ** goto lbl11
    lbl9:
        // 1 sources

        while (true) {
            var1_1 = "control ";
    lbl11:
            // 2 sources

            return KeyStroke.getKeyStroke(var1_1 + var0);
        }
        catch (RuntimeException v1) {
            ** continue;
        }
    }
            
Reference Encryption PREMIUM

Replaces method invocations and field references with an invokedynamic opcode. Makes decompiling extremely hard.

Before

   public static boolean isMacOS() {
      if (isMacOS == '?') {
         try {
            String var0 = System.getProperty("mrj.version");
            if (var0 != null) {
               isMacOS = 'Y';
            } else {
               isMacOS = 'N';
            }
         } catch (Exception var1) {
            isMacOS = 'N';
         }
      }

      return isMacOS == 'Y';
   }
            
After

    public static boolean isMacOS() {
        if (invokedynamic(-kzdm24:()C) == '?') {
            try {
                if (invokedynamic(-kzdlw4:(Ljava/lang/String;)Ljava/lang/String;, "mrj.version") != null) {
                }
                // invokedynamic(-kzdlw9:(C)V, 89)
                else {
                }
                // invokedynamic(-kzdlvn:(C)V, 78)
            }
            catch (Exception ex) {
            }
            // invokedynamic(-kzdlvu:(C)V, 78)
        }
        return invokedynamic(-kzdlvz:()C) == 'Y';
    }
            
String Encryption

Encrypts all strings & replaces them with an invokedynamic opcode. Makes them illegible & non-searchable for reverse engineers.

Before

    public static String getPref(String string, String string2) {
        try {
            Preferences preferences = Preferences.userRoot();
            Preferences preferences2 = preferences.node("/edu/hws/edu/umb");
            return preferences2.get(string, string2);
        }
        catch (Exception exception) {
            return string2;
        }
    }
            
After

    public static String getPref(String var0, String var1) {
      try {
         Preferences var2 = Preferences.userRoot();
         Preferences var3 = var2.node(͆Ì?());
         return var3.get(var0, var1);
      } catch (Exception var4) {
         return var1;
      }
   }
            
Number Obfuscation

Converts ints and longs to complex terms. Unusual constants like -1880695587 are protected more than more occuring ones like 256.

Before

    public static boolean isMacOS() {
        if (isMacOS != '?') return isMacOS == 'Y';
        try {
            String string = System.getProperty("mrj.version");
            isMacOS = string != null ? (char)89 : (char)78;
        }
        catch (Exception exception) {
            isMacOS = (char)78;
        }
        return isMacOS == 'Y';
    }
            
After

    public static boolean isMacOS() {
        if (isMacOS != (Integer.parseInt("npbl7p", 34) << 7008 ^ (0x39172A6E ^ 0x79594D72))) return isMacOS == (1876736255 >>> 1184) - (-1687724146 - 730506984);
        try {
            String string = System.getProperty("mrj.version");
            isMacOS = string != null ? (char)(0x67DA10FA ^ 0x82314F26 ^ -483424197 - -45864778) : (char)((0x277D1F76 ^ 0x277D1F51) << (4353 << 6528));
        }
        catch (Exception exception) {
            isMacOS = (char)((0x4CC88836 ^ 0xC18AF087) + (1925023645 >>> Integer.parseInt("6ce", 29)));
        }
        return isMacOS == (1876736255 >>> 1184) - (-1687724146 - 730506984);
    }
            
Scramble code logic LIGHTWEIGHT

Scrambles code but maintains performance and size. for example converts characters into bit operations, removes useless attributes and more.

Before

    var10 = var19[var20 - 1] + var17 + 1 - var19[var20];
    var11 = var10 / 2;
    int var12 = (var10 + 1) / 2;
    int var13 = var19[var20 - 1] - 12 + var17 / 2 - (var20 - 1) * (var17 + 1);
    int var14 = 12 + var2 + var17 - var17 / 2 - var19[var20] - (var5 - var20) * (var17 + 1) + 1;

    int var15;
    int var16;
    for(var15 = var20 - 1; var11 > 0; --var15) {
        var16 = var19[var15] - (var19[var15 - 1] + var17 + 1);
        var19[var15] -= var11;
        if (var16 > 0) {
            var11 -= var16;
        }
    }
            
After

    var10 = var19[var20 - 1] + var17 + 1 - var19[var20];
    var11 = var10 >> -63;
    int var12 = var10 + 1 >> 289;
    int var13 = var19[var20 - 1] - 12 + (var17 >> -639) - (var20 - 1) * (var17 + 1);
    int var14 = 12 + var2 + var17 - (var17 >> 33) - var19[var20] - (var5 - var20) * (var17 + 1) + 1;

    int var15;
    int var16;
    for(var15 = var20 - 1; var11 > 0; var15 -= 43) {
        var16 = var19[var15] - (var19[var15 - 1] + var17 + 1);
        var19[var15] -= var11;
        if (var16 > 0) {
            var11 -= var16;
        }

        var15 += 42;
    }
            
Instantiation coverage new

Hide runtime instantiations by using cover classes that extend the original classes. new IllegalStateException(); is turned into new \u0300();

Before

   final BufferedImage b = new BufferedImage(source.getWidth() + 60, source.getHeight() + 60, 2);
   final Graphics g = b.createGraphics();
   g.setColor(new Color(16777215, true));
            
After

   \u0696 b = new \u0696(source.getWidth() + 60, source.getHeight() + 60, 2);
   Graphics2D g = b.createGraphics();
   g.setColor((Color)new \u0636(0xFFFFFF, true));
            
Generalize access

Removes all access modifiers that could help a possible reverse engineer. Makes it harder to identify which fields are changed and which remain unchanged.

Crash RE-tools PREMIUM

Uses different methods & exploits to crash nearly all GUI reverse engineering tools.

Anti-debug

Disables certain debugging methods that could be useful for potential attackers.