@Test public void test2() { ClassGroup group = ClassGroupFactory.generateGroup(); Code code = group.findClass("test").findMethod("func").getCode(); Instructions ins = code.getInstructions(); code.setMaxStack(3); Instruction body[] = { new AConstNull(ins), new Dup(ins), new GetField(ins, new Field(new Class("test"), "field", Type.INT)), new LDC(ins, 830083863), new IMul(ins), new LDC(ins, 830083863), new IAdd(ins), new Dup_X1(ins), new LDC(ins, 636900519), new IMul(ins), new VReturn(ins) }; for (Instruction i : body) { ins.addInstruction(i); } Execution e = new Execution(group); e.populateInitialMethods(); e.run(); Deobfuscator d = new DupDeobfuscator(); d.run(group); long dupCount = ins.getInstructions().stream() .filter(i -> i instanceof Dup) .count(); Assert.assertEquals(1, dupCount); dupCount = ins.getInstructions().stream() .filter(i -> i instanceof Dup_X1) .count(); Assert.assertEquals(0, dupCount); }
@Override public void run(ClassGroup group) { Execution e = new Execution(group); e.addMethodContextVisitor(m -> visit(m)); e.populateInitialMethods(); e.run(); logger.info("Replaced {} dup instructions", count); }
DupDeobfuscator implements Deobfuscator { @Override public void run(ClassGroup group) { Execution e = new Execution(group); e.addMethodContextVisitor(m -> visit(m)); e.populateInitialMethods(); e.run(); logger.info("Replaced {} dup instructions", count); } }
DupDeobfuscator implements Deobfuscator { @Override public void run(ClassGroup group) { Execution e = new Execution(group); e.addMethodContextVisitor(m -> visit(m)); e.populateInitialMethods(); e.run(); logger.info("Replaced {} dup instructions", count); }  }
DupDeobfuscator implements Deobfuscator { @Override public void run(ClassGroup group) { Execution e = new Execution(group); e.addMethodContextVisitor(m -> visit(m)); e.populateInitialMethods(); e.run(); logger.info("Replaced {} dup instructions", count); }  @Override void run(ClassGroup group); }
DupDeobfuscator implements Deobfuscator { @Override public void run(ClassGroup group) { Execution e = new Execution(group); e.addMethodContextVisitor(m -> visit(m)); e.populateInitialMethods(); e.run(); logger.info("Replaced {} dup instructions", count); }  @Override void run(ClassGroup group);  }