XXX wip save. I think this might be due to calculating max stack incorrectly due to long/double.
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
package net.runelite.asm.attributes.code;
|
package net.runelite.asm.attributes.code;
|
||||||
|
|
||||||
import net.runelite.asm.attributes.Code;
|
import net.runelite.asm.attributes.Code;
|
||||||
import net.runelite.asm.attributes.code.instruction.types.JumpingInstruction;
|
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
@@ -9,7 +8,6 @@ import java.io.DataOutputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Instructions
|
public class Instructions
|
||||||
|
|||||||
@@ -23,74 +23,62 @@ import net.runelite.deob.util.JarUtil;
|
|||||||
public class Deob
|
public class Deob
|
||||||
{
|
{
|
||||||
public static void main(String[] args) throws IOException
|
public static void main(String[] args) throws IOException
|
||||||
{
|
{
|
||||||
//merge(); if(true) return;
|
|
||||||
|
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
|
|
||||||
ClassGroup group = JarUtil.loadJar(new File(args[0]));
|
ClassGroup group = JarUtil.loadJar(new File(args[0]));
|
||||||
|
|
||||||
run(group, new RenameUnique());
|
// run(group, new RenameUnique());
|
||||||
|
//
|
||||||
// remove except RuntimeException
|
// // remove except RuntimeException
|
||||||
run(group, new RuntimeExceptions());
|
// run(group, new RuntimeExceptions());
|
||||||
|
//
|
||||||
// remove unused methods
|
// // remove unused methods
|
||||||
run(group, new UnreachedCode());
|
// run(group, new UnreachedCode());
|
||||||
run(group, new UnusedMethods());
|
// run(group, new UnusedMethods());
|
||||||
|
//
|
||||||
// remove illegal state exceptions, frees up some parameters
|
// // remove illegal state exceptions, frees up some parameters
|
||||||
run(group, new IllegalStateExceptions());
|
// run(group, new IllegalStateExceptions());
|
||||||
|
//
|
||||||
// remove constant logically dead parameters
|
// // remove constant logically dead parameters
|
||||||
run(group, new ConstantParameter());
|
// run(group, new ConstantParameter());
|
||||||
|
//
|
||||||
// remove unhit blocks
|
// // remove unhit blocks
|
||||||
run(group, new UnreachedCode());
|
// run(group, new UnreachedCode());
|
||||||
run(group, new UnusedMethods());
|
// run(group, new UnusedMethods());
|
||||||
|
|
||||||
// remove unused parameters
|
// remove unused parameters
|
||||||
run(group, new UnusedParameters());
|
run(group, new UnusedParameters());
|
||||||
|
//
|
||||||
// remove unused fields
|
// // remove unused fields
|
||||||
run(group, new UnusedFields());
|
// run(group, new UnusedFields());
|
||||||
|
//
|
||||||
// remove unused methods, again?
|
// // remove unused methods, again?
|
||||||
run(group, new UnusedMethods());
|
// run(group, new UnusedMethods());
|
||||||
|
//
|
||||||
// run(group, new MethodInliner());
|
// run(group, new FieldInliner());
|
||||||
// run(group, new UnusedMethods()); // inliner might leave unused methods
|
//
|
||||||
|
// run(group, new UnusedClass());
|
||||||
// // broken because rename was removed
|
//
|
||||||
// //run(group, new MethodMover());
|
// ModArith mod = new ModArith();
|
||||||
|
// mod.run(group);
|
||||||
run(group, new FieldInliner());
|
//
|
||||||
|
// int last = -1, cur;
|
||||||
// // XXX this is broken because when moving clinit around, some fields can depend on other fields
|
// while ((cur = mod.runOnce()) > 0)
|
||||||
// // (like multianewarray)
|
// {
|
||||||
// //new FieldMover().run(group);
|
// new MultiplicationDeobfuscator().run(group);
|
||||||
|
//
|
||||||
run(group, new UnusedClass());
|
// new MultiplyOneDeobfuscator().run(group);
|
||||||
|
//
|
||||||
ModArith mod = new ModArith();
|
// new MultiplyZeroDeobfuscator().run(group);
|
||||||
mod.run(group);
|
//
|
||||||
|
// if (last == cur)
|
||||||
int last = -1, cur;
|
// break;
|
||||||
while ((cur = mod.runOnce()) > 0)
|
//
|
||||||
{
|
// last = cur;
|
||||||
new MultiplicationDeobfuscator().run(group);
|
// }
|
||||||
|
//
|
||||||
new MultiplyOneDeobfuscator().run(group);
|
// mod.annotateEncryption();
|
||||||
|
|
||||||
new MultiplyZeroDeobfuscator().run(group);
|
|
||||||
|
|
||||||
if (last == cur)
|
|
||||||
break;
|
|
||||||
|
|
||||||
last = cur;
|
|
||||||
}
|
|
||||||
|
|
||||||
mod.annotateEncryption();
|
|
||||||
|
|
||||||
JarUtil.saveJar(group, new File(args[1]));
|
JarUtil.saveJar(group, new File(args[1]));
|
||||||
|
|
||||||
@@ -98,15 +86,6 @@ public class Deob
|
|||||||
System.out.println("Done in " + ((end - start) / 1000L) + "s");
|
System.out.println("Done in " + ((end - start) / 1000L) + "s");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void merge() throws IOException
|
|
||||||
{
|
|
||||||
ClassGroup group1 = JarUtil.loadJar(new File("d:/rs/07/adamin1.jar")),
|
|
||||||
group2 = JarUtil.loadJar(new File("d:/rs/07/adamin2.jar"));
|
|
||||||
//
|
|
||||||
// Rename2 rename = new Rename2();
|
|
||||||
// rename.run(group1, group2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isObfuscated(String name)
|
public static boolean isObfuscated(String name)
|
||||||
{
|
{
|
||||||
return name.length() <= 2 || name.startsWith("method") || name.startsWith("vmethod") || name.startsWith("field") || name.startsWith("class");
|
return name.length() <= 2 || name.startsWith("method") || name.startsWith("vmethod") || name.startsWith("field") || name.startsWith("class");
|
||||||
|
|||||||
@@ -39,11 +39,10 @@ public class UnusedParameters implements Deobfuscator
|
|||||||
InvokeInstruction ii = (InvokeInstruction) i;
|
InvokeInstruction ii = (InvokeInstruction) i;
|
||||||
List<Method> methods = ii.getMethods();
|
List<Method> methods = ii.getMethods();
|
||||||
|
|
||||||
if (!unused.containsKey(methods))
|
//if (!unused.containsKey(methods))
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
for (Method m : methods)
|
invokes.put(i, ictx);
|
||||||
invokes.put(i, ictx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildUnused(ClassGroup group)
|
private void buildUnused(ClassGroup group)
|
||||||
@@ -165,6 +164,7 @@ public class UnusedParameters implements Deobfuscator
|
|||||||
ii.removeParameter(paramIndex); // remove parameter from instruction
|
ii.removeParameter(paramIndex); // remove parameter from instruction
|
||||||
|
|
||||||
Collection<InstructionContext> ics = invokes.get(i);//execution.getInstructonContexts(i);
|
Collection<InstructionContext> ics = invokes.get(i);//execution.getInstructonContexts(i);
|
||||||
|
assert ics != null;
|
||||||
if (ics != null)
|
if (ics != null)
|
||||||
{
|
{
|
||||||
InstructionContext ins = ics.toArray(new InstructionContext[0])[0];
|
InstructionContext ins = ics.toArray(new InstructionContext[0])[0];
|
||||||
@@ -231,6 +231,7 @@ public class UnusedParameters implements Deobfuscator
|
|||||||
System.out.println("PASS " + pnum++ + " " + i);
|
System.out.println("PASS " + pnum++ + " " + i);
|
||||||
|
|
||||||
count += i;
|
count += i;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
while (i > 0);
|
while (i > 0);
|
||||||
|
|
||||||
|
|||||||
@@ -2,13 +2,9 @@ package net.runelite.deob.deobfuscators;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
|
||||||
import net.runelite.asm.ClassGroup;
|
import net.runelite.asm.ClassGroup;
|
||||||
import net.runelite.asm.Method;
|
|
||||||
import net.runelite.asm.signature.util.VirtualMethods;
|
|
||||||
import net.runelite.deob.util.JarUtil;
|
import net.runelite.deob.util.JarUtil;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Assert;
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|||||||
Reference in New Issue
Block a user