fix unused methods again
This commit is contained in:
@@ -153,6 +153,7 @@ public class ClassFile
|
||||
if (m != null)
|
||||
return m;
|
||||
|
||||
// XXX is this necessary?
|
||||
ClassFile parent = getParent();
|
||||
if (parent != null)
|
||||
return parent.findMethod(nat);
|
||||
@@ -172,15 +173,26 @@ public class ClassFile
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void clearClassGraph()
|
||||
{
|
||||
parent = null;
|
||||
children.clear();
|
||||
}
|
||||
|
||||
public void buildClassGraph()
|
||||
{
|
||||
ClassFile other = getParent();
|
||||
if (other == null)
|
||||
return; // inherits from a class not in my group
|
||||
|
||||
this.parent = other;
|
||||
parent.children.add(this);
|
||||
ClassFile other = group.findClass(super_class.getName());
|
||||
if (other != null)
|
||||
{
|
||||
this.parent = other;
|
||||
parent.children.add(this);
|
||||
}
|
||||
|
||||
for (ClassFile i : interfaces.getInterfaces())
|
||||
{
|
||||
i.children.add(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void buildInstructionGraph()
|
||||
|
||||
@@ -36,6 +36,9 @@ public class ClassGroup
|
||||
|
||||
public void buildClassGraph()
|
||||
{
|
||||
for (ClassFile c : classes)
|
||||
c.clearClassGraph();
|
||||
|
||||
for (ClassFile c : classes)
|
||||
c.buildClassGraph();
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class Deob
|
||||
new UnusedBlocks().run(group);
|
||||
|
||||
// remove unused parameters
|
||||
new UnusedParameters().run(group);
|
||||
//new UnusedParameters().run(group);
|
||||
|
||||
// remove jump obfuscation
|
||||
new Jumps().run(group);
|
||||
|
||||
@@ -68,7 +68,7 @@ public class InvokeVirtual extends Instruction implements InvokeInstruction
|
||||
|
||||
ins.push(ctx);
|
||||
}
|
||||
|
||||
|
||||
for (info.sigterm.deob.Method method : getMethods())
|
||||
{
|
||||
ins.invoke(method);
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.math.BigInteger;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import info.sigterm.deob.ClassFile;
|
||||
import info.sigterm.deob.ClassGroup;
|
||||
@@ -129,6 +130,12 @@ public class ModularArithmeticDeobfuscation
|
||||
}
|
||||
}
|
||||
System.out.println("Found " + constants.size() + " constants");
|
||||
for (Entry<Field, Integer> entry : constants.entrySet())
|
||||
{
|
||||
Field f = entry.getKey();
|
||||
Integer v = entry.getValue();
|
||||
System.out.println(f.getClassEntry().getName() + "." + f.getNameAndType().getName() + " -> " + v);
|
||||
}
|
||||
}
|
||||
|
||||
private static BigInteger modInverse(BigInteger val, int bits)
|
||||
|
||||
@@ -11,9 +11,11 @@ public class UnusedMethods
|
||||
{
|
||||
public void run(ClassGroup group)
|
||||
{
|
||||
group.buildClassGraph();
|
||||
|
||||
Execution execution = new Execution(group);
|
||||
execution.populateInitialMethods();
|
||||
execution.run();
|
||||
execution.run();
|
||||
|
||||
int i = 0;
|
||||
for (ClassFile cf : group.getClasses())
|
||||
|
||||
Reference in New Issue
Block a user