开发者

Injecting a class into the JVM and interacting with existing classes

I want to inject my Java class into an existing Java application, on Windows.

I found an article describing a method using CreateRemoteThread - java-code-injection-via-winapis

But it's not clear if the injected class can 'connect' with the existing classes and call them.

Does anybody know if this is possible? Are there functions in the JNI which can be used to search and get a reference to already running classe开发者_如何学运维s?


i'm sure there are other complicated ways to do what you want to do (e.g. using the java instrumentation apis). however, there is probably a much easier way.

  1. find the class which is the main class for the application
  2. decompile the class into java code.
  3. add a simple hook to invoke your custom code (or otherwise modify this class to suit your needs)
  4. recompile the modified class and replace the class file in the relevant jar
  5. run your modified application!
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜