This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |