Skip to content

Instantly share code, notes, and snippets.

View vadim8kiselev's full-sized avatar

Vadim Kiselev vadim8kiselev

View GitHub Profile
import com.sun.tools.attach.VirtualMachine;
import java.nio.file.Paths;
public class InjectAgent {
public static void main(String[] args) throws Exception {
String PID = args[0];
String agentJar = Paths.get("retransformer.jar").toAbsolutePath().toString();
import java.lang.instrument.*;
import java.security.ProtectionDomain;
public class GetBytecode implements ClassFileTransformer {
private static Instrumentation inst;
public static synchronized void agentmain(String args, Instrumentation inst) {
GetBytecode.inst = inst;
}