I have an obfuscated java binary which does runtime code injection using java reflection like this.
Object o = "a long string";
((Method)o).invoke(params..);
(If I write this in a java file, it would compile fine, but I have to edit the disassembly of the class file and remove checkcast instruction to make it run.)
What I want to do is disassemble/decompile the content of the long string as JVM bytecode. Since this is not a full class, but only a method, I can't get any of the available java reverse engineering tools to work with it.
I'm now trying to inject this code into a separate class at runtime and then dump it out of memory. But I'm not sure if it's possible to do. even using a javaagent.
Is there any other easy way to accomplish what I'm trying to do?