You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
allows to load the classes in a different classloader (might be possible with javaagent with some weird tricks)
Because the classes are loaded in a new URLClassLoader instance, you can unload the classes by deleting the URLClassLoader
depending on the jvm, and on the launch command, the VirtualMachine attach api to load the java agent at runtime might be disabled (I think it can be bypassed by calling loadAgent0 with jni manually, instead of using the java VirtualMachine class)
I'm still reading the jvm source code to understand the class loading process and clear some of the traces it leaves.
I made another, bit simpler injector with the same advantages here: https://github.com/Lefraudeur/RuntimeJarLoader
Overall this can in fact be considered as a java agent, it's just not using the usual java Attach api.
If by "java agent" you mean a jar that follows the usual structure, so an agentmain method with a Instrumentation object instance in the parametes, then ye you are right, this would be easier.
However the goal here is to not store the jar file on disk and to be able to unload it.
So I have to use c++ with jvmti instead.
The project is far from done, I plan on making a mixin like json file, where you can put the event hooks you want to apply.
You could make a much simpler injector for java agent hack. What are the advantages of your method?
The text was updated successfully, but these errors were encountered: