forked from Whoopsunix/JavaRce
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathB64.java
More file actions
38 lines (33 loc) · 970 Bytes
/
B64.java
File metadata and controls
38 lines (33 loc) · 970 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package org.command.exec.jni;
import com.sun.org.apache.bcel.internal.Repository;
import com.sun.org.apache.bcel.internal.classfile.JavaClass;
import java.util.Arrays;
import java.util.Base64;
/**
* @author Whoopsunix
*/
public class B64 {
public static void main(String[] args) {
// encode_obj(Calc.class);
}
public static String encode_obj(Class cls){
try {
JavaClass javaClass = Repository.lookupClass(cls);
System.out.println(Arrays.toString(javaClass.getBytes()));
return encode_str(javaClass.getBytes());
} catch (Exception e) {
e.printStackTrace();
}
return "";
}
public static String encode_str(byte[] b) {
try {
String str = Base64.getEncoder().encodeToString(b);
System.out.println(str);
return str;
} catch (Exception e) {
e.printStackTrace();
}
return "";
}
}