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