mirror of
https://github.com/xiaozhou233/JuiceAgent.git
synced 2026-12-05 13:05:53 +08:00
Test: add bytecode API integration tests
- add Java tests for getClassBytes(ByName), redefineClass(ByName), retransformClass(ByName) and defineClass - ignore tests/tmp/ directory for captured bytecode output
This commit is contained in:
1 parent
63dd69abc6
commit
4833b512f5
8 files changed
+182
-1
No files matched your search
@@ -0,0 +1,20 @@
|
||||
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();
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user