hm
This commit is contained in:
@@ -8,6 +8,7 @@ import java.io.DataInputStream;
|
|||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class Field
|
public class Field
|
||||||
{
|
{
|
||||||
@@ -95,4 +96,10 @@ public class Field
|
|||||||
{
|
{
|
||||||
return attributes;
|
return attributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode()
|
||||||
|
{
|
||||||
|
return name.hashCode();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -18,6 +18,7 @@ import java.io.DataOutputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import net.runelite.deob.attributes.code.instruction.types.PushConstantInstruction;
|
import net.runelite.deob.attributes.code.instruction.types.PushConstantInstruction;
|
||||||
|
import net.runelite.deob.deobfuscators.arithmetic.DMath;
|
||||||
import net.runelite.deob.deobfuscators.arithmetic.Encryption;
|
import net.runelite.deob.deobfuscators.arithmetic.Encryption;
|
||||||
import net.runelite.deob.deobfuscators.arithmetic.Pair;
|
import net.runelite.deob.deobfuscators.arithmetic.Pair;
|
||||||
|
|
||||||
@@ -40,6 +41,33 @@ public class PutStatic extends Instruction implements SetFieldInstruction
|
|||||||
super.write(out);
|
super.write(out);
|
||||||
out.writeShort(this.getPool().make(field));
|
out.writeShort(this.getPool().make(field));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static StackContext findMagic(StackContext one, StackContext two)
|
||||||
|
{
|
||||||
|
if (one.getPushed().getInstruction() instanceof PushConstantInstruction)
|
||||||
|
{
|
||||||
|
PushConstantInstruction pci = (PushConstantInstruction) one.getPushed().getInstruction();
|
||||||
|
int value1 = (int) pci.getConstant().getObject();
|
||||||
|
|
||||||
|
if (DMath.isBig(value1))
|
||||||
|
{
|
||||||
|
return one;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (two.getPushed().getInstruction() instanceof PushConstantInstruction)
|
||||||
|
{
|
||||||
|
PushConstantInstruction pci = (PushConstantInstruction) two.getPushed().getInstruction();
|
||||||
|
int value2 = (int) pci.getConstant().getObject();
|
||||||
|
|
||||||
|
if (DMath.isBig(value2))
|
||||||
|
{
|
||||||
|
return two;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Frame frame)
|
public void execute(Frame frame)
|
||||||
@@ -92,25 +120,11 @@ public class PutStatic extends Instruction implements SetFieldInstruction
|
|||||||
|
|
||||||
StackContext one = stackCtx.get(0), two = stackCtx.get(1);
|
StackContext one = stackCtx.get(0), two = stackCtx.get(1);
|
||||||
|
|
||||||
if (one.getPushed().getInstruction() instanceof PushConstantInstruction)
|
StackContext magicStack = findMagic(one, two);
|
||||||
|
|
||||||
|
if (magicStack != null)
|
||||||
{
|
{
|
||||||
PushConstantInstruction pci = (PushConstantInstruction) one.getPushed().getInstruction();
|
PushConstantInstruction pci = (PushConstantInstruction) magicStack.getPushed().getInstruction();
|
||||||
int value = (int) pci.getConstant().getObject();
|
|
||||||
|
|
||||||
// field is encrypted with pair
|
|
||||||
// divide value by setter
|
|
||||||
|
|
||||||
if (value != 0 && value != 1)
|
|
||||||
{
|
|
||||||
value = value * pair.getter;
|
|
||||||
|
|
||||||
encryption.change(pci, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else if (two.getPushed().getInstruction() instanceof PushConstantInstruction)
|
|
||||||
{
|
|
||||||
PushConstantInstruction pci = (PushConstantInstruction) two.getPushed().getInstruction();
|
|
||||||
int value = (int) pci.getConstant().getObject();
|
int value = (int) pci.getConstant().getObject();
|
||||||
|
|
||||||
// field is encrypted with pair
|
// field is encrypted with pair
|
||||||
@@ -123,8 +137,40 @@ public class PutStatic extends Instruction implements SetFieldInstruction
|
|||||||
encryption.change(pci, value);
|
encryption.change(pci, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
assert false;
|
// if (one.getPushed().getInstruction() instanceof PushConstantInstruction)
|
||||||
|
// {
|
||||||
|
// PushConstantInstruction pci = (PushConstantInstruction) one.getPushed().getInstruction();
|
||||||
|
// int value = (int) pci.getConstant().getObject();
|
||||||
|
//
|
||||||
|
// // field is encrypted with pair
|
||||||
|
// // divide value by setter
|
||||||
|
//
|
||||||
|
// if (value != 0 && value != 1)
|
||||||
|
// {
|
||||||
|
// value = value * pair.getter;
|
||||||
|
//
|
||||||
|
// encryption.change(pci, value);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// else if (two.getPushed().getInstruction() instanceof PushConstantInstruction)
|
||||||
|
// {
|
||||||
|
// PushConstantInstruction pci = (PushConstantInstruction) two.getPushed().getInstruction();
|
||||||
|
// int value = (int) pci.getConstant().getObject();
|
||||||
|
//
|
||||||
|
// // field is encrypted with pair
|
||||||
|
// // divide value by setter
|
||||||
|
//
|
||||||
|
// if (value != 0 && value != 1)
|
||||||
|
// {
|
||||||
|
// value = value * pair.getter;
|
||||||
|
//
|
||||||
|
// encryption.change(pci, value);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// assert false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,4 +32,9 @@ public class DMath
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isBig(int val)
|
||||||
|
{
|
||||||
|
return (val & 0xFFF00000) != 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import java.util.Map;
|
|||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import net.runelite.deob.Field;
|
import net.runelite.deob.Field;
|
||||||
import net.runelite.deob.attributes.code.instruction.types.PushConstantInstruction;
|
import net.runelite.deob.attributes.code.instruction.types.PushConstantInstruction;
|
||||||
|
import net.runelite.deob.attributes.code.instructions.SiPush;
|
||||||
|
|
||||||
public class Encryption
|
public class Encryption
|
||||||
{
|
{
|
||||||
@@ -42,6 +43,10 @@ public class Encryption
|
|||||||
|
|
||||||
public void change(PushConstantInstruction pci, int value)
|
public void change(PushConstantInstruction pci, int value)
|
||||||
{
|
{
|
||||||
|
if (pci instanceof SiPush)
|
||||||
|
{
|
||||||
|
int i =5;
|
||||||
|
}
|
||||||
assert !changes.containsKey(pci) || changes.get(pci) == value;
|
assert !changes.containsKey(pci) || changes.get(pci) == value;
|
||||||
changes.put(pci, value);
|
changes.put(pci, value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ public class ModArith implements Deobfuscator
|
|||||||
System.out.println("Processing " + field.getName());
|
System.out.println("Processing " + field.getName());
|
||||||
int getter = constants.getCollection(field).iterator().next();
|
int getter = constants.getCollection(field).iterator().next();
|
||||||
|
|
||||||
if (i > 5)
|
if (i > 50)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
Pair pair = new Pair();
|
Pair pair = new Pair();
|
||||||
|
|||||||
Reference in New Issue
Block a user