Gets the implementation code for the specified method of the class object in memory.

encrypted files are loaded into memory, and the class object (class ) is obtained through classloader. And then called through reflection. Now you need to get a method implementation in this class. Is there any feasible way?
uses apache"s commons-bcel library, the Repository.instanceOf method. Failed to get javaclass type object. This problem can be solved. After getting the javaclass, you can get the code. of the specified method. But return null.

Update: you can now get the javaclass object. But getCode is garbled.
Please solve this problem if you have similar experience.


feels that your need is not just a reflection library bcel can solve, may need to involve decompilation knowledge, the project found online , hope to help you


feel a little superfluous. The final solution is to read the confused class binary file, decrypt it in memory, get byte [] and write it to the file, that is, the decrypted class, is dragged to idea to see the source code.

Menu