use of net.runelite.asm.ClassGroup in project runelite by runelite.
the class MultiplyOneDeobfuscatorTest method test2.
// iconst_1
// iconst_m1
// iload 5
// if_icmpeq LABEL0x56d1
// iload 5
// iconst_1
// if_icmpne LABEL0x56e8
// goto LABEL0x56d1
// LABEL0x56d1:
// getstatic class139/field2130 I
// ldc_w -1440517609
// imul
// goto LABEL0x5708
// LABEL0x56e8:
// getstatic class139/field2130 I
// ldc_w -1440517609
// imul
// getstatic client/field377 I
// iadd
// iconst_2
// idiv
// LABEL0x5708:
// imul
// putstatic client/field377 I
//
// client.field377 = 1 * (-1 != var5 && var5 != 1?(class139.field2130 + client.field377) / 2:class139.field2130);
@Test
public void test2() {
ClassGroup group = ClassGroupFactory.generateGroup();
Code code = group.findClass("test").findMethod("func").getCode();
Instructions ins = code.getInstructions();
code.setMaxStack(2);
// vars[0] = 3
Instruction[] prepareVariables = { new LDC(ins, 3), new IStore(ins, 0), new LDC(ins, 2), new IStore(ins, 1) };
for (Instruction i : prepareVariables) ins.addInstruction(i);
Label label = new Label(ins), label2 = new Label(ins), label3 = new Label(ins);
LDC one = new LDC(ins, 1);
IMul mul = new IMul(ins);
Instruction[] body = { one, new LDC(ins, -1), new ILoad(ins, 0), new IfICmpEq(ins, label), new Goto(ins, label2), label, new ILoad(ins, 1), new LDC(ins, -1440517609), new IDiv(ins), new Goto(ins, label3), label2, new ILoad(ins, 1), new LDC(ins, -1440517609), new IDiv(ins), label3, mul, new VReturn(ins) };
for (Instruction i : body) ins.addInstruction(i);
// check execution runs ok
Execution e = new Execution(group);
e.populateInitialMethods();
e.run();
Deobfuscator d = new MultiplyOneDeobfuscator(false);
d.run(group);
Assert.assertTrue(one.getInstructions() == null);
Assert.assertTrue(mul.getInstructions() == null);
}
use of net.runelite.asm.ClassGroup in project runelite by runelite.
the class InvokeVirtual method lookupMethod.
private net.runelite.asm.Method lookupMethod() {
ClassGroup group = this.getInstructions().getCode().getMethod().getClassFile().getGroup();
ClassFile otherClass = group.findClass(method.getClazz().getName());
if (otherClass == null) {
// not our class
return null;
}
net.runelite.asm.Method m = otherClass.findMethodDeep(method.getName(), method.getType());
return m;
}
use of net.runelite.asm.ClassGroup in project runelite by runelite.
the class InvokeSpecial method lookup.
@Override
public void lookup() {
myMethod = null;
ClassGroup group = this.getInstructions().getCode().getMethod().getClassFile().getGroup();
ClassFile otherClass = group.findClass(method.getClazz().getName());
if (otherClass == null) {
// not our class
return;
}
net.runelite.asm.Method other = otherClass.findMethod(method.getName(), method.getType());
if (other == null) {
return;
}
myMethod = other;
}
use of net.runelite.asm.ClassGroup in project runelite by runelite.
the class InvokeStatic method lookupMethod.
private net.runelite.asm.Method lookupMethod() {
ClassGroup group = this.getInstructions().getCode().getMethod().getClassFile().getGroup();
ClassFile otherClass = group.findClass(method.getClazz().getName());
if (otherClass == null) {
// not our class
return null;
}
net.runelite.asm.Method other = otherClass.findMethodDeepStatic(method.getName(), method.getType());
if (other == null) {
// when regenerating the pool after renaming the method this can be null.
return null;
}
return other;
}
use of net.runelite.asm.ClassGroup in project runelite by runelite.
the class UpdateMappingsTest method testRun.
@Test
public void testRun() throws IOException {
File client = new File(properties.getRsClient());
ClassGroup group1 = JarUtil.loadJar(client);
ClassGroup group2 = JarUtil.loadJar(client);
// Remove existing annotations
unannotate(group2);
// Map the client against itself
map(group1, group2);
check(group1, group2);
}
Aggregations