mirror of
https://github.com/xiaozhou233/JuiceAgent.git
synced 2026-12-05 13:05:53 +08:00
- add Java tests for getClassBytes(ByName), redefineClass(ByName), retransformClass(ByName) and defineClass - ignore tests/tmp/ directory for captured bytecode output
21 lines
581 B
Java
21 lines
581 B
Java
import cn.xiaozhou233.juiceagent.api.JuiceAgent;
|
|
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
import java.nio.file.Files;
|
|
|
|
public class RetransformClassByName {
|
|
public static void main(String[] args) throws IOException {
|
|
System.load(new File("resources/libagent.dll").getAbsolutePath());
|
|
JuiceAgent.init("");
|
|
|
|
Target.targetTest();
|
|
|
|
byte[] bytes = Files.readAllBytes(new File("out/production/injection/Target.class").toPath());
|
|
JuiceAgent.retransformClassByName("Target", bytes, bytes.length);
|
|
|
|
Target.targetTest();
|
|
|
|
}
|
|
}
|