Fixes to unique rename, just use getMethods() instead of comparing names
This commit is contained in:
@@ -42,10 +42,7 @@ public class Deob
|
|||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
|
|
||||||
ClassGroup group = loadJar(args[0]);
|
ClassGroup group = loadJar(args[0]);
|
||||||
|
|
||||||
new RenameUnique().run(group);
|
|
||||||
|
|
||||||
/*
|
|
||||||
// remove except RuntimeException
|
// remove except RuntimeException
|
||||||
new RuntimeExceptions().run(group);
|
new RuntimeExceptions().run(group);
|
||||||
|
|
||||||
@@ -68,7 +65,8 @@ public class Deob
|
|||||||
new UnusedFields().run(group);
|
new UnusedFields().run(group);
|
||||||
|
|
||||||
//new ModularArithmeticDeobfuscation().run(group);
|
//new ModularArithmeticDeobfuscation().run(group);
|
||||||
*/
|
|
||||||
|
new RenameUnique().run(group);
|
||||||
|
|
||||||
saveJar(group, args[1]);
|
saveJar(group, args[1]);
|
||||||
|
|
||||||
|
|||||||
@@ -180,7 +180,8 @@ public class InvokeInterface extends Instruction implements InvokeInstruction
|
|||||||
@Override
|
@Override
|
||||||
public void renameMethod(info.sigterm.deob.Method m, String name)
|
public void renameMethod(info.sigterm.deob.Method m, String name)
|
||||||
{
|
{
|
||||||
if (method.getNameAndType().equals(m.getNameAndType()) && method.getClassEntry().getName().equals(m.getMethods().getClassFile().getName()))
|
for (info.sigterm.deob.Method m2 : getMethods())
|
||||||
method = new InterfaceMethod(method.getClassEntry(), new NameAndType(name, method.getNameAndType().getDescriptor()));
|
if (m2.equals(m))
|
||||||
|
method = new InterfaceMethod(method.getClassEntry(), new NameAndType(name, method.getNameAndType().getDescriptor()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ public class InvokeSpecial extends Instruction implements InvokeInstruction
|
|||||||
return new ArrayList<>(); // not our class
|
return new ArrayList<>(); // not our class
|
||||||
|
|
||||||
info.sigterm.deob.Method other = otherClass.findMethodDeep(method.getNameAndType());
|
info.sigterm.deob.Method other = otherClass.findMethodDeep(method.getNameAndType());
|
||||||
|
assert other != null;
|
||||||
|
|
||||||
List<info.sigterm.deob.Method> list = new ArrayList<>();
|
List<info.sigterm.deob.Method> list = new ArrayList<>();
|
||||||
list.add(other);
|
list.add(other);
|
||||||
@@ -172,7 +173,8 @@ public class InvokeSpecial extends Instruction implements InvokeInstruction
|
|||||||
@Override
|
@Override
|
||||||
public void renameMethod(info.sigterm.deob.Method m, String name)
|
public void renameMethod(info.sigterm.deob.Method m, String name)
|
||||||
{
|
{
|
||||||
if (method.getNameAndType().equals(m.getNameAndType()) && method.getClassEntry().getName().equals(m.getMethods().getClassFile().getName()))
|
for (info.sigterm.deob.Method m2 : getMethods())
|
||||||
method = new Method(method.getClassEntry(), new NameAndType(name, method.getNameAndType().getDescriptor()));
|
if (m2.equals(m))
|
||||||
|
method = new Method(method.getClassEntry(), new NameAndType(name, method.getNameAndType().getDescriptor()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ public class InvokeStatic extends Instruction implements InvokeInstruction
|
|||||||
return new ArrayList<>(); // not our class
|
return new ArrayList<>(); // not our class
|
||||||
|
|
||||||
info.sigterm.deob.Method other = otherClass.findMethodDeep(method.getNameAndType());
|
info.sigterm.deob.Method other = otherClass.findMethodDeep(method.getNameAndType());
|
||||||
|
assert other != null;
|
||||||
|
|
||||||
List<info.sigterm.deob.Method> list = new ArrayList<>();
|
List<info.sigterm.deob.Method> list = new ArrayList<>();
|
||||||
list.add(other);
|
list.add(other);
|
||||||
@@ -169,7 +170,14 @@ public class InvokeStatic extends Instruction implements InvokeInstruction
|
|||||||
@Override
|
@Override
|
||||||
public void renameMethod(info.sigterm.deob.Method m, String name)
|
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()));
|
method = new Method(method.getClassEntry(), new NameAndType(name, method.getNameAndType().getDescriptor()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -179,7 +179,8 @@ public class InvokeVirtual extends Instruction implements InvokeInstruction
|
|||||||
@Override
|
@Override
|
||||||
public void renameMethod(info.sigterm.deob.Method m, String name)
|
public void renameMethod(info.sigterm.deob.Method m, String name)
|
||||||
{
|
{
|
||||||
if (method.getNameAndType().equals(m.getNameAndType()) && method.getClassEntry().getName().equals(m.getMethods().getClassFile().getName()))
|
for (info.sigterm.deob.Method m2 : getMethods())
|
||||||
method = new Method(method.getClassEntry(), new NameAndType(name, method.getNameAndType().getDescriptor()));
|
if (m2.equals(m))
|
||||||
|
method = new Method(method.getClassEntry(), new NameAndType(name, method.getNameAndType().getDescriptor()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package info.sigterm.deob.execution;
|
|||||||
import info.sigterm.deob.ClassFile;
|
import info.sigterm.deob.ClassFile;
|
||||||
import info.sigterm.deob.ClassGroup;
|
import info.sigterm.deob.ClassGroup;
|
||||||
import info.sigterm.deob.Method;
|
import info.sigterm.deob.Method;
|
||||||
import info.sigterm.deob.attributes.code.Exceptions;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@@ -40,6 +39,8 @@ public class Execution
|
|||||||
|
|
||||||
public void addMethod(Method method)
|
public void addMethod(Method method)
|
||||||
{
|
{
|
||||||
|
assert method != null;
|
||||||
|
|
||||||
if (methods.contains(method))
|
if (methods.contains(method))
|
||||||
return; // already processed
|
return; // already processed
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user