Rename unique first
This commit is contained in:
@@ -42,6 +42,8 @@ public class Deob
|
||||
long start = System.currentTimeMillis();
|
||||
|
||||
ClassGroup group = loadJar(args[0]);
|
||||
|
||||
new RenameUnique().run(group);
|
||||
|
||||
// remove except RuntimeException
|
||||
new RuntimeExceptions().run(group);
|
||||
@@ -68,8 +70,6 @@ public class Deob
|
||||
new UnusedFields().run(group);
|
||||
|
||||
//new ModularArithmeticDeobfuscation().run(group);
|
||||
|
||||
new RenameUnique().run(group);
|
||||
|
||||
saveJar(group, args[1]);
|
||||
|
||||
@@ -77,6 +77,11 @@ public class Deob
|
||||
System.out.println("Done in " + ((end - start) / 1000L) + "s");
|
||||
}
|
||||
|
||||
public static boolean isObfuscated(String name)
|
||||
{
|
||||
return name.startsWith("method") || name.startsWith("vmethod") || name.startsWith("field") || name.startsWith("class");
|
||||
}
|
||||
|
||||
private static ClassGroup loadJar(String jarfile) throws IOException
|
||||
{
|
||||
ClassGroup group = new ClassGroup();
|
||||
|
||||
@@ -2,6 +2,7 @@ package info.sigterm.deob.deobfuscators;
|
||||
|
||||
import info.sigterm.deob.ClassFile;
|
||||
import info.sigterm.deob.ClassGroup;
|
||||
import info.sigterm.deob.Deob;
|
||||
import info.sigterm.deob.Deobfuscator;
|
||||
import info.sigterm.deob.Method;
|
||||
import info.sigterm.deob.execution.Execution;
|
||||
@@ -24,9 +25,7 @@ public class UnusedMethods implements Deobfuscator
|
||||
{
|
||||
for (Method m : new ArrayList<>(cf.getMethods().getMethods()))
|
||||
{
|
||||
// assume obfuscated names are <= 2 chars
|
||||
// constructors can be unused, too
|
||||
if (m.getName().length() > 2 && !m.getName().equals("<init>"))
|
||||
if (!Deob.isObfuscated(m.getName()))
|
||||
continue;
|
||||
|
||||
if (!execution.methods.contains(m))
|
||||
|
||||
@@ -2,6 +2,7 @@ package info.sigterm.deob.deobfuscators;
|
||||
|
||||
import info.sigterm.deob.ClassFile;
|
||||
import info.sigterm.deob.ClassGroup;
|
||||
import info.sigterm.deob.Deob;
|
||||
import info.sigterm.deob.Deobfuscator;
|
||||
import info.sigterm.deob.Method;
|
||||
import info.sigterm.deob.attributes.Code;
|
||||
@@ -206,7 +207,7 @@ public class UnusedParameters implements Deobfuscator
|
||||
{
|
||||
for (Method m : cf.getMethods().getMethods())
|
||||
{
|
||||
if (done.contains(m) || m.getName().length() > 2) // ctors not uniquely renamed. overriding jre methods can't just remove a parameter
|
||||
if (done.contains(m) || !Deob.isObfuscated(m.getName()))
|
||||
continue;
|
||||
|
||||
int offset = m.isStatic() ? 0 : 1;
|
||||
|
||||
@@ -2,6 +2,7 @@ package info.sigterm.deob.execution;
|
||||
|
||||
import info.sigterm.deob.ClassFile;
|
||||
import info.sigterm.deob.ClassGroup;
|
||||
import info.sigterm.deob.Deob;
|
||||
import info.sigterm.deob.Method;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -28,8 +29,7 @@ public class Execution
|
||||
{
|
||||
for (Method m : cf.getMethods().getMethods())
|
||||
{
|
||||
// ob'd names seem to be <= 2
|
||||
if (m.getName().length() > 2)
|
||||
if (!Deob.isObfuscated(m.getName()))
|
||||
{
|
||||
addMethod(m); // I guess this method name is overriding a jre interface (init, run, ?).
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user