Java 8. This finally settles down by leaves many fields still obfuscated.

This commit is contained in:
Adam
2015-10-19 21:14:21 -04:00
parent 19cd153e37
commit c2e1da7125
3 changed files with 71 additions and 39 deletions

View File

@@ -51,7 +51,7 @@
</plugins> </plugins>
</build> </build>
<properties> <properties>
<maven.compiler.source>1.7</maven.compiler.source> <maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target> <maven.compiler.target>1.8</maven.compiler.target>
</properties> </properties>
</project> </project>

View File

@@ -54,25 +54,26 @@ public class Deob
// //
// // remove constant logically dead parameters // // remove constant logically dead parameters
// run(group, new ConstantParameter()); // run(group, new ConstantParameter());
//
// remove unhit blocks // // remove unhit blocks
// run(group, new UnreachedCode()); // run(group, new UnreachedCode());
// run(group, new UnusedMethods()); // run(group, new UnusedMethods());
//
// remove unused parameters // // remove unused parameters
run(group, new UnusedParameters()); // run(group, new UnusedParameters());
//
// remove jump obfuscation // // remove jump obfuscation
//new Jumps().run(group); // //new Jumps().run(group);
//
// remove unused fields // // remove unused fields
//run(group, new UnusedFields()); // run(group, new UnusedFields());
//
// remove unused methods, again? // // remove unused methods, again?
//run(group, new UnusedMethods()); // run(group, new UnusedMethods());
// //
// run(group, new MethodInliner()); // run(group, new MethodInliner());
// //
// // broken because rename was removed
// //run(group, new MethodMover()); // //run(group, new MethodMover());
// //
// run(group, new FieldInliner()); // run(group, new FieldInliner());
@@ -83,27 +84,27 @@ public class Deob
// //
// run(group, new UnusedClass()); // run(group, new UnusedClass());
// ModArith mod = new ModArith(); ModArith mod = new ModArith();
// mod.run(group); mod.run(group);
//
// int last = -1, cur; int last = -1, cur;
// while ((cur = mod.runOnce()) > 0) while ((cur = mod.runOnce()) > 0)
// { {
// new MultiplicationDeobfuscator().run(group); new MultiplicationDeobfuscator().run(group);
//
// new MultiplyOneDeobfuscator().run(group); new MultiplyOneDeobfuscator().run(group);
//
// new MultiplyZeroDeobfuscator().run(group); new MultiplyZeroDeobfuscator().run(group);
//
// if (last == cur) if (last == cur)
// { {
// System.out.println("break"); System.out.println("break");
// break; break;
// } }
//
// last = cur; last = cur;
// //break; break;
// } }
saveJar(group, args[1]); saveJar(group, args[1]);

View File

@@ -7,6 +7,7 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors;
import net.runelite.deob.ClassFile; import net.runelite.deob.ClassFile;
import net.runelite.deob.ClassGroup; import net.runelite.deob.ClassGroup;
import net.runelite.deob.Deobfuscator; import net.runelite.deob.Deobfuscator;
@@ -17,6 +18,7 @@ import net.runelite.deob.attributes.code.Instruction;
import net.runelite.deob.attributes.code.Instructions; import net.runelite.deob.attributes.code.Instructions;
import net.runelite.deob.attributes.code.instruction.types.FieldInstruction; import net.runelite.deob.attributes.code.instruction.types.FieldInstruction;
import net.runelite.deob.attributes.code.instruction.types.GetFieldInstruction; import net.runelite.deob.attributes.code.instruction.types.GetFieldInstruction;
import net.runelite.deob.attributes.code.instruction.types.InvokeInstruction;
import net.runelite.deob.attributes.code.instruction.types.PushConstantInstruction; import net.runelite.deob.attributes.code.instruction.types.PushConstantInstruction;
import net.runelite.deob.attributes.code.instruction.types.SetFieldInstruction; import net.runelite.deob.attributes.code.instruction.types.SetFieldInstruction;
import net.runelite.deob.attributes.code.instructions.IMul; import net.runelite.deob.attributes.code.instructions.IMul;
@@ -88,6 +90,7 @@ public class ModArith implements Deobfuscator
} }
// find big constant // find big constant
boolean big = false;
for (InstructionContext i : ins) for (InstructionContext i : ins)
{ {
if (i.getInstruction() instanceof LDC_W) if (i.getInstruction() instanceof LDC_W)
@@ -98,10 +101,25 @@ public class ModArith implements Deobfuscator
int value = ldc.getConstantAsInt(); int value = ldc.getConstantAsInt();
if (DMath.isBig(value)) if (DMath.isBig(value))
return true; big = true;
} }
} }
} }
// for (InstructionContext i : ins)
// {
// if (i.getInstruction() instanceof InvokeInstruction)
// {
// if (!big)
// {
// // if no ob is detected and its passed to an invoke, it must be deobbed
// return false;
// }
// }
// }
if (big)
return true;
} }
return false; return false;
@@ -367,7 +385,20 @@ public class ModArith implements Deobfuscator
Collection<Integer> getters = constantGetters.getCollection(f), Collection<Integer> getters = constantGetters.getCollection(f),
setters = constantSetters.getCollection(f); setters = constantSetters.getCollection(f);
if (f.getName().equals("field2976")) if (getters != null)
{
getters = getters.stream().filter(c -> DMath.isBig(c)).collect(Collectors.toList());
if (getters.isEmpty())
getters = null;
}
if (setters != null)
{
setters = setters.stream().filter(c -> DMath.isBig(c)).collect(Collectors.toList());
if (setters.isEmpty())
setters = null;
}
if (f.getName().equals("field347"))
{ {
int k=5; int k=5;
} }