Also direct assignment
This commit is contained in:
@@ -56,6 +56,18 @@ public class PutStatic extends Instruction implements SetFieldInstruction
|
|||||||
{
|
{
|
||||||
Pair pair = encryption.getField(myField);
|
Pair pair = encryption.getField(myField);
|
||||||
InstructionContext ctx = object.getPushed();
|
InstructionContext ctx = object.getPushed();
|
||||||
|
if (ctx.getInstruction() instanceof PushConstantInstruction && pair != null)
|
||||||
|
{
|
||||||
|
// field = encryptedvalue
|
||||||
|
// decrypt value by * getter
|
||||||
|
|
||||||
|
PushConstantInstruction pci = (PushConstantInstruction) ctx.getInstruction();
|
||||||
|
int value = (int) pci.getConstant().getObject();
|
||||||
|
|
||||||
|
value = value * pair.getter;
|
||||||
|
|
||||||
|
encryption.change(pci, value);
|
||||||
|
}
|
||||||
if (ctx.getInstruction() instanceof ISub)
|
if (ctx.getInstruction() instanceof ISub)
|
||||||
{
|
{
|
||||||
List<StackContext> stackCtx = ctx.getPops();
|
List<StackContext> stackCtx = ctx.getPops();
|
||||||
|
|||||||
@@ -10,10 +10,17 @@ public class Encryption
|
|||||||
{
|
{
|
||||||
private Map<Field, Pair> fields = new HashMap<>();
|
private Map<Field, Pair> fields = new HashMap<>();
|
||||||
private Map<PushConstantInstruction, Integer> changes = new HashMap<>();
|
private Map<PushConstantInstruction, Integer> changes = new HashMap<>();
|
||||||
|
int i;
|
||||||
|
private Pair p;
|
||||||
|
|
||||||
|
public Encryption(int i)
|
||||||
|
{
|
||||||
|
this.i = i;
|
||||||
|
}
|
||||||
|
|
||||||
public Pair getField(Field field)
|
public Pair getField(Field field)
|
||||||
{
|
{
|
||||||
if (field.getName().equals("field1170"))
|
if (i == 0 && field.getName().equals("field1170"))
|
||||||
{
|
{
|
||||||
Pair p = new Pair();
|
Pair p = new Pair();
|
||||||
p.field = field;
|
p.field = field;
|
||||||
@@ -22,6 +29,15 @@ public class Encryption
|
|||||||
assert p.setter == 1237096007;
|
assert p.setter == 1237096007;
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
if (i == 1 && field.getName().equals("field700"))
|
||||||
|
{
|
||||||
|
Pair p = new Pair();
|
||||||
|
p.field = field;
|
||||||
|
p.getter = -478315765;
|
||||||
|
p.setter = DMath.modInverse(p.getter);
|
||||||
|
//assert p.setter ==
|
||||||
|
return p;
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
//return fields.get(field);
|
//return fields.get(field);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -179,7 +179,18 @@ public class ModArith implements Deobfuscator
|
|||||||
execution = new Execution(group);
|
execution = new Execution(group);
|
||||||
execution.populateInitialMethods();
|
execution.populateInitialMethods();
|
||||||
|
|
||||||
Encryption encr = new Encryption();
|
Encryption encr = new Encryption(0);
|
||||||
|
execution.setEncryption(encr);
|
||||||
|
|
||||||
|
execution.run();
|
||||||
|
|
||||||
|
encr.doChange();
|
||||||
|
|
||||||
|
|
||||||
|
execution = new Execution(group);
|
||||||
|
execution.populateInitialMethods();
|
||||||
|
|
||||||
|
encr = new Encryption(1);
|
||||||
execution.setEncryption(encr);
|
execution.setEncryption(encr);
|
||||||
|
|
||||||
execution.run();
|
execution.run();
|
||||||
|
|||||||
Reference in New Issue
Block a user