This is the code of my Agent.jar
public class Agent
{
public static void agentmain(String s, Instrumentation instrumentation)
{
try
{
ClassLoader classLoader = null;
for (Class clazz : instrumentation.getAllLoadedClasses())
{
String className = clazz.getName();
if (className.equalsIgnoreCase("ave")) /* Just a class from the running Programm */
{
classLoader = clazz.getClassLoader();
}
}
/* In the Cheat.jar are Classes which im trying to load */
ClassLoader loader = URLClassLoader.newInstance(new URL[]{new URL("C:\\Users\\michi\\Desktop\\Injection\\Cheat.jar")}, classLoader);
Class.forName("de.simplyblack.client.client.module.Category", true, loader);
Class.forName("de.simplyblack.client.client.module.Module", true, loader);
Class.forName("de.simplyblack.client.client.module.ModuleManager", true, loader);
} catch (Throwable t)
{
t.printStackTrace();
}
}
}
I am loading this with an extra Programm.
VirtualMachine virtualMachine = VirtualMachine.attach(id);
virtualMachine.loadAgent(new File("C:\\Users\\michi\\Desktop\\Injection\\Client.jar").getAbsolutePath());
virtualMachine.detach();
But this is not working.
Later I visit an Class, and make an call for the ModuleManager class.
If I Inject it, i get an
Class not found: de.simplyblack.client.client.module.ModuleManager
error.
Could you please tell me how I can fix that? It would help me a lot! Thanks.