Fixes to unique rename, just use getMethods() instead of comparing names

This commit is contained in:
Adam
2015-07-11 13:34:32 -04:00
parent e263694eac
commit 3fbb69e102
6 changed files with 24 additions and 13 deletions

View File

@@ -42,10 +42,7 @@ public class Deob
long start = System.currentTimeMillis();
ClassGroup group = loadJar(args[0]);
new RenameUnique().run(group);
/*
// remove except RuntimeException
new RuntimeExceptions().run(group);
@@ -68,7 +65,8 @@ public class Deob
new UnusedFields().run(group);
//new ModularArithmeticDeobfuscation().run(group);
*/
new RenameUnique().run(group);
saveJar(group, args[1]);

View File

@@ -180,7 +180,8 @@ public class InvokeInterface extends Instruction implements InvokeInstruction
@Override
public void renameMethod(info.sigterm.deob.Method m, String name)
{
if (method.getNameAndType().equals(m.getNameAndType()) && method.getClassEntry().getName().equals(m.getMethods().getClassFile().getName()))
method = new InterfaceMethod(method.getClassEntry(), new NameAndType(name, method.getNameAndType().getDescriptor()));
for (info.sigterm.deob.Method m2 : getMethods())
if (m2.equals(m))
method = new InterfaceMethod(method.getClassEntry(), new NameAndType(name, method.getNameAndType().getDescriptor()));
}
}

View File

@@ -52,6 +52,7 @@ public class InvokeSpecial extends Instruction implements InvokeInstruction
return new ArrayList<>(); // not our class
info.sigterm.deob.Method other = otherClass.findMethodDeep(method.getNameAndType());
assert other != null;
List<info.sigterm.deob.Method> list = new ArrayList<>();
list.add(other);
@@ -172,7 +173,8 @@ public class InvokeSpecial extends Instruction implements InvokeInstruction
@Override
public void renameMethod(info.sigterm.deob.Method m, String name)
{
if (method.getNameAndType().equals(m.getNameAndType()) && method.getClassEntry().getName().equals(m.getMethods().getClassFile().getName()))
method = new Method(method.getClassEntry(), new NameAndType(name, method.getNameAndType().getDescriptor()));
for (info.sigterm.deob.Method m2 : getMethods())
if (m2.equals(m))
method = new Method(method.getClassEntry(), new NameAndType(name, method.getNameAndType().getDescriptor()));
}
}

View File

@@ -52,6 +52,7 @@ public class InvokeStatic extends Instruction implements InvokeInstruction
return new ArrayList<>(); // not our class
info.sigterm.deob.Method other = otherClass.findMethodDeep(method.getNameAndType());
assert other != null;
List<info.sigterm.deob.Method> list = new ArrayList<>();
list.add(other);
@@ -169,7 +170,14 @@ public class InvokeStatic extends Instruction implements InvokeInstruction
@Override
public void renameMethod(info.sigterm.deob.Method m, String name)
{
if (method.getNameAndType().equals(m.getNameAndType()) && method.getClassEntry().getName().equals(m.getMethods().getClassFile().getName()))
ClassGroup group = this.getInstructions().getCode().getAttributes().getClassFile().getGroup();
ClassFile otherClass = group.findClass(method.getClassEntry().getName());
if (otherClass == null)
return; // not our class
info.sigterm.deob.Method other = otherClass.findMethodDeep(method.getNameAndType());
if (other.equals(m))
method = new Method(method.getClassEntry(), new NameAndType(name, method.getNameAndType().getDescriptor()));
}
}

View File

@@ -179,7 +179,8 @@ public class InvokeVirtual extends Instruction implements InvokeInstruction
@Override
public void renameMethod(info.sigterm.deob.Method m, String name)
{
if (method.getNameAndType().equals(m.getNameAndType()) && method.getClassEntry().getName().equals(m.getMethods().getClassFile().getName()))
method = new Method(method.getClassEntry(), new NameAndType(name, method.getNameAndType().getDescriptor()));
for (info.sigterm.deob.Method m2 : getMethods())
if (m2.equals(m))
method = new Method(method.getClassEntry(), new NameAndType(name, method.getNameAndType().getDescriptor()));
}
}

View File

@@ -3,7 +3,6 @@ package info.sigterm.deob.execution;
import info.sigterm.deob.ClassFile;
import info.sigterm.deob.ClassGroup;
import info.sigterm.deob.Method;
import info.sigterm.deob.attributes.code.Exceptions;
import java.util.ArrayList;
import java.util.HashSet;
@@ -40,6 +39,8 @@ public class Execution
public void addMethod(Method method)
{
assert method != null;
if (methods.contains(method))
return; // already processed