mirror of
https://github.com/xiaozhou233/JuiceAgent.git
synced 2026-12-05 21:15:56 +08:00
Feat: add retransform-class example with build/run scripts and docs
This commit is contained in:
1 parent
57405e810c
commit
b08656daa6
14 files changed
+340
-4
No files matched your search
Binary file not shown.
@@ -0,0 +1,25 @@
|
||||
import cn.xiaozhou233.juiceagent.api.JuiceAgent;
|
||||
|
||||
public class playload {
|
||||
public static void entry() throws java.io.IOException {
|
||||
System.out.println("Playload loaded!");
|
||||
|
||||
java.io.InputStream in = new java.io.FileInputStream("new_target.class");
|
||||
java.io.ByteArrayOutputStream out = new java.io.ByteArrayOutputStream();
|
||||
byte[] buf = new byte[4096];
|
||||
int len;
|
||||
while ((len = in.read(buf)) != -1) {
|
||||
out.write(buf, 0, len);
|
||||
}
|
||||
byte[] bytes = out.toByteArray();
|
||||
in.close();
|
||||
|
||||
JuiceAgent.retransformClassByName(
|
||||
"target",
|
||||
bytes,
|
||||
bytes.length
|
||||
);
|
||||
|
||||
System.out.println("Playload executed!");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user