More multi fixes. Spinning is back with multiplication deobfuscator..
This commit is contained in:
@@ -84,9 +84,9 @@ public class Deob
|
||||
|
||||
//new ModArith().run(group);
|
||||
|
||||
//new MultiplicationDeobfuscator().run(group);
|
||||
//new MultiplicationDeobfuscator().run(group); // this causes spinning?
|
||||
|
||||
//new MultiplyOneDeobfuscator().run(group);
|
||||
new MultiplyOneDeobfuscator().run(group);
|
||||
|
||||
new MultiplyZeroDeobfuscator().run(group);
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ 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.SiPush;
|
||||
import net.runelite.deob.execution.Execution;
|
||||
import net.runelite.deob.execution.Frame;
|
||||
import net.runelite.deob.execution.InstructionContext;
|
||||
@@ -57,6 +58,21 @@ public class MultiplicationDeobfuscator implements Deobfuscator
|
||||
return l;
|
||||
}
|
||||
|
||||
private boolean isOnlyPath(Execution execution, Frame frame, InstructionContext ctx)
|
||||
{
|
||||
for (Frame f : execution.processedFrames)
|
||||
if (f.getMethod() == frame.getMethod())
|
||||
for (InstructionContext i : f.getInstructions())
|
||||
if (i.getInstruction() == ctx.getInstruction())
|
||||
{
|
||||
if (!i.equals(ctx))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private int runOnce()
|
||||
{
|
||||
group.buildClassGraph();
|
||||
@@ -77,7 +93,7 @@ public class MultiplicationDeobfuscator implements Deobfuscator
|
||||
|
||||
if (!(instruction instanceof IMul))
|
||||
continue;
|
||||
|
||||
|
||||
List<InstructionContext> ins = getConstants(ictx);
|
||||
|
||||
if (ins.size() == 1)
|
||||
@@ -91,6 +107,10 @@ public class MultiplicationDeobfuscator implements Deobfuscator
|
||||
}
|
||||
}
|
||||
|
||||
// there can only be one path to here, or else combinging would change code logic
|
||||
if (!isOnlyPath(e, frame, ictx))
|
||||
continue;
|
||||
|
||||
int result = 1;
|
||||
|
||||
// calculate result
|
||||
|
||||
@@ -7,6 +7,7 @@ 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.NOP;
|
||||
import net.runelite.deob.execution.Execution;
|
||||
import net.runelite.deob.execution.Frame;
|
||||
import net.runelite.deob.execution.InstructionContext;
|
||||
@@ -58,7 +59,8 @@ public class MultiplyOneDeobfuscator implements Deobfuscator
|
||||
continue;
|
||||
|
||||
ictx.removeStack(removeIdx);
|
||||
ins.remove(ictx.getInstruction());
|
||||
ins.replace(ictx.getInstruction(), new NOP(ins));
|
||||
//ins.remove(ictx.getInstruction());
|
||||
|
||||
++count;
|
||||
}
|
||||
|
||||
@@ -32,12 +32,6 @@ public class MultiplyZeroDeobfuscator implements Deobfuscator
|
||||
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;
|
||||
|
||||
@@ -57,10 +51,6 @@ public class MultiplyZeroDeobfuscator implements Deobfuscator
|
||||
|
||||
if (value == 0)
|
||||
remove = true;
|
||||
if (value == -1408052237)
|
||||
{
|
||||
int i = 5;
|
||||
}
|
||||
}
|
||||
if (itwo instanceof PushConstantInstruction)
|
||||
{
|
||||
@@ -69,10 +59,6 @@ public class MultiplyZeroDeobfuscator implements Deobfuscator
|
||||
|
||||
if (value == 0)
|
||||
remove = true;
|
||||
if (value == -1408052237)
|
||||
{
|
||||
int i = 5;
|
||||
}
|
||||
}
|
||||
|
||||
if (remove == false)
|
||||
|
||||
Reference in New Issue
Block a user