Flow Obfuscation
Changes the flow of your code to make it harder to reverse, Includes adding loops, breaking loops, detecting exceptions, etc.
// Given Input
package dev.sim0n.evaluator.test.impl.annotation;
import dev.sim0n.evaluator.Main;
import dev.sim0n.evaluator.test.Test;
import dev.sim0n.evaluator.test.impl.annotation.TestAnnotation;
@TestAnnotation(string="Test", doubleValue=0.36, intValue=36)
public class AnnotationTest
implements Test {
public void handle() {
Class<AnnotationTest> clazz = AnnotationTest.class;
if (clazz.isAnnotationPresent(TestAnnotation.class)) {
TestAnnotation annotation = (TestAnnotation)clazz.getAnnotation(TestAnnotation.class);
String value = annotation.string();
double doubleValue = annotation.doubleValue();
int intValue = annotation.intValue();
Main.LOG.println("Testing annotations");
Main.LOG.println(String.format((String)"%s, %s, %d", (Object[])new Object[]{value, doubleValue, intValue}));
}
}
}
// Output
package dev.sim0n.evaluator.test.impl.annotation;
import dev.sim0n.evaluator.Main;
import dev.sim0n.evaluator.test.Test;
import dev.sim0n.evaluator.test.impl.annotation.TestAnnotation;
@TestAnnotation(string="Test", doubleValue=0.36, intValue=36)
public class AnnotationTest
implements Test {
public static final int ff;
public static final boolean fg = false;
/*
* WARNING - void declaration
*/
public void handle() {
Class<TestAnnotation> clazz;
Class<AnnotationTest> clazz2;
block8: {
clazz2 = AnnotationTest.class;
try {
clazz = TestAnnotation.class;
break block8;
}
catch (RuntimeException runtimeException) {
// empty catch block
}
while (true) {
// Infinite loop
}
}
if (clazz2.isAnnotationPresent(clazz)) {
Double d;
void annotation;
try {
TestAnnotation testAnnotation = (TestAnnotation)clazz2.getAnnotation(TestAnnotation.class);
}
catch (IllegalStateException illegalStateException) {
illegalStateException.printStackTrace();
throw illegalStateException;
}
String value = annotation.string();
double doubleValue = annotation.doubleValue();
int intValue = annotation.intValue();
Main.LOG.println("Testing annotations");
Object[] objectArray = new Object[3];
objectArray[0] = value;
try {
d = doubleValue;
}
catch (IllegalStateException illegalStateException) {
illegalStateException.printStackTrace();
throw illegalStateException;
}
objectArray[1] = d;
objectArray[2] = intValue;
Main.LOG.println(String.format((String)"%s, %s, %d", (Object[])objectArray));
}
}
}
Last updated