Lefraudeur / Mujina-Public

A cross-platform injectable cheat base for minecraft made in java, loaded with c++
MIT License
11 stars 1 forks source link

Why not javaagent? #1

Open erxson opened 2 weeks ago

erxson commented 2 weeks ago

You could make a much simpler injector for java agent hack. What are the advantages of your method?

Lefraudeur commented 2 weeks ago

for now not much, ig

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.

I don't see the point of making an injector for java agents because it already exists, it's a feature builtin in the jdk, it has already been done before. https://docs.oracle.com/en/java/javase/22/docs/api/java.instrument/java/lang/instrument/package-summary.html https://docs.oracle.com/en/java/javase/22/docs/api/jdk.attach/com/sun/tools/attach/VirtualMachine.html