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