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

📄 test.pas

📁 OICQ黑客工具。可以查看对方IP地址
💻 PAS
字号:
unit test;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Db, DBTables, Grids, DBGrids,data,winsock;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Label1: TLabel;
    AddrTable: TTable;
    DataSource1: TDataSource;
    AddrTableSTARTIP: TStringField;
    AddrTableENDIP: TStringField;
    AddrTableCOUNTRY: TStringField;
    AddrTableLOCAL: TStringField;
    AddrTableTHANK: TStringField;
    Button2: TButton;
    Edit1: TEdit;
    Button3: TButton;
    ListBox: TListBox;
    Button4: TButton;
    Button5: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
  private
    { Private declarations }
    FSocket:TSocket;
    Loop:Boolean;
  public
    { Public declarations }
  end;
//const
//SOCK_RAW=3;
//IPPROTO_RAW=255;
var
  Form1: TForm1;

implementation

{$R *.DFM}
uses info;
function StrToIp(str:string):DWORD;
var
s:string;
l,i,parse:Integer;
adr:array [0..3] of DWORD;
begin
parse:=0;
l:=length(str);
for i:=1 to l+1 do
    begin
    if(i<=l) and (str[i]<>'.')then
        begin
        s:=s+str[i];
        end
    else
        begin
        adr[parse]:=StrToIntDef(s,0);
        Inc(parse);
        s:='';
        end;
    end;
Result:=(adr[0]shl 24)or(adr[1] shl 16) or(adr[2] shl 8) or adr[3];
end;
function IPEqu(ip1,ip2:string):Boolean;
begin
Result:=(StrToIp(ip1)=StrToIp(ip2));
end;

procedure TForm1.Button1Click(Sender: TObject);
var
f:File of TIPInfo;
info:TIPInfo;
begin
AssignFile(f,'IP.dat');
Rewrite(f);
AddrTable.Open;
while not AddrTable.Eof do
    begin
    info.StartIp:=AddrTable.FieldByName('StartIp').AsString;
    info.EndIp:=AddrTable.FIeldBYName('EndIp').AsString;
    info.Country:=AddrTable.FieldByName('Country').AsString;
    info.Location:=AddrTable.FieldByName('LOCAL').AsString;
    Write(f,info);
    AddrTable.Next;
    end;
AddrTable.Close;
CloseFile(f);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
LoadIPInfo('ip.dat');
ShowMessage(IntToStr(IpInfoCnt));
end;

procedure TForm1.Button3Click(Sender: TObject);
var
IpInf:TIPInfo;
begin
IpInf:=FindIPInfo(Edit1.Text);
Edit1.Text:=IpInf.Country+IpInf.Location;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
LoadIPInfo('ip.dat');
end;

procedure TForm1.Button4Click(Sender: TObject);
var
d:TWSAData;
val:Boolean;
addr:TSockAddr;
sz:Integer;
buf:array [0..2048] of char;
begin
WSAStartup(2,d);
FSocket:=socket(AF_INET,SOCK_RAW,IPPROTO_UDP);
if(FSocket=INVALID_SOCKET)then
    begin
    ShowMessage('socket error:'+IntToStr(GetLastError));
    end;
val:=True;
{if(setsockopt(FSocket,SOl_SOCKET,SO_REUSEADDR,@val,sizeof(val))=SOCKET_ERROR)then
    begin
    ShowMessage('setsockopt error:'+IntToStr(GetLastError));
    end;}
addr.sin_family:=AF_INET;
addr.sin_port:=4000;
addr.sin_addr.s_addr := INADDR_ANY;

if(bind(FSocket,addr,sizeof(addr))=SOCKET_ERROR)then
    begin
    ShowMessage('setsockopt error:'+IntToStr(GetLastError));
    end;
sz:=sizeof(addr);
button4.enabled:=false;
button5.enabled:=true;
Loop:=True;
{while(Loop)do
    begin
    recvfrom(FSocket,buf,2048,0,addr,sz);
    ListBox.Items.add(buf);
    Application.ProcessMessages;
    end;}
end;

procedure TForm1.Button5Click(Sender: TObject);
begin
Loop:=False;
closesocket(FSOCKET);
WSACleanup;
button4.enabled:=true;
button5.enabled:=false;
end;

end.

⌨️ 快捷键说明

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