Field moving works
This commit is contained in:
@@ -46,72 +46,72 @@ public class Deob
|
||||
// bdur = System.currentTimeMillis() - bstart;
|
||||
// System.out.println("rename unique took " + bdur/1000L + " seconds");
|
||||
|
||||
// remove except RuntimeException
|
||||
bstart = System.currentTimeMillis();
|
||||
new RuntimeExceptions().run(group);
|
||||
bdur = System.currentTimeMillis() - bstart;
|
||||
System.out.println("runtime exception took " + bdur/1000L + " seconds");
|
||||
|
||||
// remove unused methods
|
||||
bstart = System.currentTimeMillis();
|
||||
new UnusedMethods().run(group);
|
||||
bdur = System.currentTimeMillis() - bstart;
|
||||
System.out.println("unused methods took " + bdur/1000L + " seconds");
|
||||
|
||||
new UnreachedCode().run(group);
|
||||
|
||||
// remove illegal state exceptions, frees up some parameters
|
||||
bstart = System.currentTimeMillis();
|
||||
new IllegalStateExceptions().run(group);
|
||||
bdur = System.currentTimeMillis() - bstart;
|
||||
System.out.println("illegal state exception took " + bdur/1000L + " seconds");
|
||||
|
||||
// remove constant logically dead parameters
|
||||
bstart = System.currentTimeMillis();
|
||||
new ConstantParameter().run(group);
|
||||
bdur = System.currentTimeMillis() - bstart;
|
||||
System.out.println("constant param took " + bdur/1000L + " seconds");
|
||||
|
||||
// remove unhit blocks
|
||||
bstart = System.currentTimeMillis();
|
||||
new UnreachedCode().run(group);
|
||||
//new UnusedBlocks().run(group);
|
||||
bdur = System.currentTimeMillis() - bstart;
|
||||
System.out.println("unused blocks took " + bdur/1000L + " seconds");
|
||||
|
||||
// remove unused parameters
|
||||
bstart = System.currentTimeMillis();
|
||||
new UnusedParameters().run(group);
|
||||
bdur = System.currentTimeMillis() - bstart;
|
||||
System.out.println("unused params took " + bdur/1000L + " seconds");
|
||||
|
||||
// remove jump obfuscation
|
||||
//new Jumps().run(group);
|
||||
|
||||
// remove unused fields
|
||||
bstart = System.currentTimeMillis();
|
||||
new UnusedFields().run(group);
|
||||
bdur = System.currentTimeMillis() - bstart;
|
||||
System.out.println("unused fields took " + bdur/1000L + " seconds");
|
||||
|
||||
// remove unused methods, again?
|
||||
bstart = System.currentTimeMillis();
|
||||
new UnusedMethods().run(group);
|
||||
bdur = System.currentTimeMillis() - bstart;
|
||||
System.out.println("unused methods took " + bdur/1000L + " seconds");
|
||||
|
||||
|
||||
new MethodInliner().run(group);
|
||||
|
||||
// new ModularArithmeticDeobfuscation().run(group);
|
||||
// // remove except RuntimeException
|
||||
// bstart = System.currentTimeMillis();
|
||||
// new RuntimeExceptions().run(group);
|
||||
// bdur = System.currentTimeMillis() - bstart;
|
||||
// System.out.println("runtime exception took " + bdur/1000L + " seconds");
|
||||
//
|
||||
// // remove unused methods
|
||||
// bstart = System.currentTimeMillis();
|
||||
// new UnusedMethods().run(group);
|
||||
// bdur = System.currentTimeMillis() - bstart;
|
||||
// System.out.println("unused methods took " + bdur/1000L + " seconds");
|
||||
//
|
||||
// new UnreachedCode().run(group);
|
||||
//
|
||||
// // remove illegal state exceptions, frees up some parameters
|
||||
// bstart = System.currentTimeMillis();
|
||||
// new IllegalStateExceptions().run(group);
|
||||
// bdur = System.currentTimeMillis() - bstart;
|
||||
// System.out.println("illegal state exception took " + bdur/1000L + " seconds");
|
||||
//
|
||||
// // remove constant logically dead parameters
|
||||
// bstart = System.currentTimeMillis();
|
||||
// new ConstantParameter().run(group);
|
||||
// bdur = System.currentTimeMillis() - bstart;
|
||||
// System.out.println("constant param took " + bdur/1000L + " seconds");
|
||||
//
|
||||
// // remove unhit blocks
|
||||
// bstart = System.currentTimeMillis();
|
||||
// new UnreachedCode().run(group);
|
||||
// //new UnusedBlocks().run(group);
|
||||
// bdur = System.currentTimeMillis() - bstart;
|
||||
// System.out.println("unused blocks took " + bdur/1000L + " seconds");
|
||||
//
|
||||
// // remove unused parameters
|
||||
// bstart = System.currentTimeMillis();
|
||||
// new UnusedParameters().run(group);
|
||||
// bdur = System.currentTimeMillis() - bstart;
|
||||
// System.out.println("unused params took " + bdur/1000L + " seconds");
|
||||
//
|
||||
// // remove jump obfuscation
|
||||
// //new Jumps().run(group);
|
||||
//
|
||||
// // remove unused fields
|
||||
// bstart = System.currentTimeMillis();
|
||||
// new UnusedFields().run(group);
|
||||
// bdur = System.currentTimeMillis() - bstart;
|
||||
// System.out.println("unused fields took " + bdur/1000L + " seconds");
|
||||
//
|
||||
// // remove unused methods, again?
|
||||
// bstart = System.currentTimeMillis();
|
||||
// new UnusedMethods().run(group);
|
||||
// bdur = System.currentTimeMillis() - bstart;
|
||||
// System.out.println("unused methods took " + bdur/1000L + " seconds");
|
||||
//
|
||||
//
|
||||
// new MethodInliner().run(group);
|
||||
//
|
||||
// new MethodMover().run(group);
|
||||
|
||||
//new FieldMover().run(group);
|
||||
//
|
||||
// new FieldInliner().run(group);
|
||||
|
||||
new FieldMover().run(group);
|
||||
|
||||
//new UnusedClass().run(group);
|
||||
|
||||
// new ModularArithmeticDeobfuscation().run(group);
|
||||
|
||||
saveJar(group, args[1]);
|
||||
|
||||
|
||||
@@ -38,11 +38,9 @@ public class Attributes
|
||||
method = m;
|
||||
}
|
||||
|
||||
public Attributes(Code c) throws IOException
|
||||
public Attributes(Code c)
|
||||
{
|
||||
code = c;
|
||||
|
||||
load();
|
||||
}
|
||||
|
||||
public Method getMethod()
|
||||
|
||||
@@ -20,6 +20,9 @@ public class Code extends Attribute
|
||||
public Code(Attributes attributes)
|
||||
{
|
||||
super(attributes, AttributeType.CODE);
|
||||
|
||||
exceptions = new Exceptions(this);
|
||||
this.attributes = new Attributes(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -34,7 +37,10 @@ public class Code extends Attribute
|
||||
instructions.load();
|
||||
|
||||
exceptions = new Exceptions(this);
|
||||
exceptions.load();
|
||||
|
||||
this.attributes = new Attributes(this);
|
||||
this.attributes.load();
|
||||
|
||||
instructions.buildBlocks();
|
||||
instructions.buildJumpGraph();
|
||||
|
||||
@@ -14,10 +14,13 @@ public class Exceptions
|
||||
private Code code;
|
||||
private List<Exception> exceptions = new ArrayList<Exception>();
|
||||
|
||||
public Exceptions(Code code) throws IOException
|
||||
public Exceptions(Code code)
|
||||
{
|
||||
this.code = code;
|
||||
|
||||
}
|
||||
|
||||
public void load() throws IOException
|
||||
{
|
||||
DataInputStream is = code.getAttributes().getStream();
|
||||
|
||||
int count = is.readUnsignedShort();
|
||||
|
||||
@@ -200,6 +200,8 @@ public class FieldMover implements Deobfuscator
|
||||
code.setInstructions(instructions);
|
||||
|
||||
instructions.getInstructions().add(new VReturn(instructions, InstructionType.RETURN, 0)); // add return
|
||||
|
||||
to.getMethods().getMethods().add(toClinit);
|
||||
}
|
||||
|
||||
moveInitializer(setField, toClinit);
|
||||
|
||||
@@ -255,15 +255,15 @@ public class UnusedParameters implements Deobfuscator
|
||||
|
||||
@Override
|
||||
public void run(ClassGroup group)
|
||||
{
|
||||
Execution execution = new Execution(group);
|
||||
execution.populateInitialMethods();
|
||||
execution.run();
|
||||
|
||||
{
|
||||
int count = 0;
|
||||
int[] i;
|
||||
do
|
||||
{
|
||||
Execution execution = new Execution(group);
|
||||
execution.populateInitialMethods();
|
||||
execution.run();
|
||||
|
||||
i = checkParametersOnce(execution, group);
|
||||
|
||||
count += i[0];
|
||||
|
||||
Reference in New Issue
Block a user