IT GETS ME EVERY TIME
This commit is contained in:
@@ -28,6 +28,7 @@ import net.runelite.deob.deobfuscators.UnusedParameters;
|
|||||||
import net.runelite.deob.deobfuscators.arithmetic.ModArith;
|
import net.runelite.deob.deobfuscators.arithmetic.ModArith;
|
||||||
import net.runelite.deob.deobfuscators.arithmetic.MultiplicationDeobfuscator;
|
import net.runelite.deob.deobfuscators.arithmetic.MultiplicationDeobfuscator;
|
||||||
import net.runelite.deob.deobfuscators.arithmetic.MultiplyOneDeobfuscator;
|
import net.runelite.deob.deobfuscators.arithmetic.MultiplyOneDeobfuscator;
|
||||||
|
import net.runelite.deob.deobfuscators.arithmetic.MultiplyZeroDeobfuscator;
|
||||||
import net.runelite.deob.execution.Execution;
|
import net.runelite.deob.execution.Execution;
|
||||||
|
|
||||||
public class Deob
|
public class Deob
|
||||||
@@ -85,7 +86,9 @@ public class Deob
|
|||||||
|
|
||||||
//new MultiplicationDeobfuscator().run(group);
|
//new MultiplicationDeobfuscator().run(group);
|
||||||
|
|
||||||
new MultiplyOneDeobfuscator().run(group);
|
//new MultiplyOneDeobfuscator().run(group);
|
||||||
|
|
||||||
|
new MultiplyZeroDeobfuscator().run(group);
|
||||||
|
|
||||||
saveJar(group, args[1]);
|
saveJar(group, args[1]);
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ public class UnreachedCode implements Deobfuscator
|
|||||||
List<Instruction> insCopy = new ArrayList<>(ins.getInstructions());
|
List<Instruction> insCopy = new ArrayList<>(ins.getInstructions());
|
||||||
|
|
||||||
for (int j = 0; j < insCopy.size(); ++j)
|
for (int j = 0; j < insCopy.size(); ++j)
|
||||||
//for (Instruction i : new ArrayList<>(ins.getInstructions()))
|
|
||||||
{
|
{
|
||||||
Instruction i = insCopy.get(j);
|
Instruction i = insCopy.get(j);
|
||||||
|
|
||||||
|
|||||||
@@ -59,6 +59,8 @@ public class MultiplicationDeobfuscator implements Deobfuscator
|
|||||||
|
|
||||||
private int runOnce()
|
private int runOnce()
|
||||||
{
|
{
|
||||||
|
group.buildClassGraph();
|
||||||
|
|
||||||
Execution e = new Execution(group);
|
Execution e = new Execution(group);
|
||||||
e.populateInitialMethods();
|
e.populateInitialMethods();
|
||||||
e.run();
|
e.run();
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ public class MultiplyOneDeobfuscator implements Deobfuscator
|
|||||||
@Override
|
@Override
|
||||||
public void run(ClassGroup group)
|
public void run(ClassGroup group)
|
||||||
{
|
{
|
||||||
|
group.buildClassGraph();
|
||||||
|
|
||||||
Execution e = new Execution(group);
|
Execution e = new Execution(group);
|
||||||
e.populateInitialMethods();
|
e.populateInitialMethods();
|
||||||
e.run();
|
e.run();
|
||||||
@@ -61,7 +63,7 @@ public class MultiplyOneDeobfuscator implements Deobfuscator
|
|||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("Removed " + count + " multiplications");
|
System.out.println("Removed " + count + " 1 multiplications");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,98 @@
|
|||||||
|
package net.runelite.deob.deobfuscators.arithmetic;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import net.runelite.deob.ClassGroup;
|
||||||
|
import net.runelite.deob.Deobfuscator;
|
||||||
|
import net.runelite.deob.attributes.code.Instruction;
|
||||||
|
import net.runelite.deob.attributes.code.Instructions;
|
||||||
|
import net.runelite.deob.attributes.code.instruction.types.PushConstantInstruction;
|
||||||
|
import net.runelite.deob.attributes.code.instructions.IMul;
|
||||||
|
import net.runelite.deob.attributes.code.instructions.LDC_W;
|
||||||
|
import net.runelite.deob.execution.Execution;
|
||||||
|
import net.runelite.deob.execution.Frame;
|
||||||
|
import net.runelite.deob.execution.InstructionContext;
|
||||||
|
import net.runelite.deob.execution.StackContext;
|
||||||
|
|
||||||
|
public class MultiplyZeroDeobfuscator implements Deobfuscator
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run(ClassGroup group)
|
||||||
|
{
|
||||||
|
group.buildClassGraph();
|
||||||
|
|
||||||
|
Execution e = new Execution(group);
|
||||||
|
e.populateInitialMethods();
|
||||||
|
e.run();
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
for (Frame frame : e.processedFrames)
|
||||||
|
for (InstructionContext ictx : frame.getInstructions())
|
||||||
|
{
|
||||||
|
Instruction instruction = ictx.getInstruction();
|
||||||
|
Instructions ins = instruction.getInstructions();
|
||||||
|
|
||||||
|
if (frame.getMethod().getName().equals("method3678"))
|
||||||
|
//if (ins.getCode().getAttributes().getMethod().getName().equals("method3678"))
|
||||||
|
{
|
||||||
|
int i = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(instruction instanceof IMul))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
List<Instruction> ilist = ins.getInstructions();
|
||||||
|
|
||||||
|
StackContext one = ictx.getPops().get(0);
|
||||||
|
StackContext two = ictx.getPops().get(1);
|
||||||
|
|
||||||
|
Instruction ione = one.getPushed().getInstruction(),
|
||||||
|
itwo = two.getPushed().getInstruction();
|
||||||
|
|
||||||
|
boolean remove = false;
|
||||||
|
if (ione instanceof PushConstantInstruction)
|
||||||
|
{
|
||||||
|
PushConstantInstruction pci = (PushConstantInstruction) ione;
|
||||||
|
int value = (int) pci.getConstant().getObject();
|
||||||
|
|
||||||
|
if (value == 0)
|
||||||
|
remove = true;
|
||||||
|
if (value == -1408052237)
|
||||||
|
{
|
||||||
|
int i = 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (itwo instanceof PushConstantInstruction)
|
||||||
|
{
|
||||||
|
PushConstantInstruction pci = (PushConstantInstruction) itwo;
|
||||||
|
int value = (int) pci.getConstant().getObject();
|
||||||
|
|
||||||
|
if (value == 0)
|
||||||
|
remove = true;
|
||||||
|
if (value == -1408052237)
|
||||||
|
{
|
||||||
|
int i = 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (remove == false)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ilist.contains(instruction))
|
||||||
|
continue; // already done
|
||||||
|
|
||||||
|
// remove both, remove imul, push 0
|
||||||
|
|
||||||
|
ictx.removeStack(1);
|
||||||
|
ictx.removeStack(0);
|
||||||
|
|
||||||
|
ins.replace(instruction, new LDC_W(ins, new net.runelite.deob.pool.Integer(0)));
|
||||||
|
|
||||||
|
++count;
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("Removed " + count + " 0 multiplications");
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user