Traduccion a Delphi de este programa para localizar una IP.
Una imagen :
(http://doddyhackman.webcindario.com/images/locateipdelphi.jpg)
El codigo :
// LocateIP 0.1
// Coded By Doddy H in the year 2013
// Based on the services :
// To get IP -- http://whatismyipaddress.com/
// To locate IP -- http://www.melissadata.com/
// To get DNS -- http://www.ip-adress.com/
unit locateip;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, sSkinManager, jpeg, ExtCtrls, StdCtrls, sLabel, sGroupBox, sButton,
sEdit, sListBox, ComCtrls, sStatusBar, IdBaseComponent, IdComponent,
IdTCPConnection, IdTCPClient, IdHTTP, PerlRegEx, IdMultipartFormData;
type
TForm1 = class(TForm)
sSkinManager1: TsSkinManager;
Image1: TImage;
sGroupBox1: TsGroupBox;
sLabel1: TsLabel;
sEdit1: TsEdit;
sButton1: TsButton;
sGroupBox2: TsGroupBox;
sLabel2: TsLabel;
sEdit2: TsEdit;
sLabel3: TsLabel;
sEdit3: TsEdit;
sLabel4: TsLabel;
sEdit4: TsEdit;
sGroupBox3: TsGroupBox;
sListBox1: TsListBox;
PerlRegEx1: TPerlRegEx;
IdHTTP1: TIdHTTP;
sStatusBar1: TsStatusBar;
procedure sButton1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
sSkinManager1.SkinDirectory := ExtractFilePath(Application.ExeName) + 'Data';
sSkinManager1.SkinName := 'matrix';
sSkinManager1.Active := True;
end;
procedure TForm1.sButton1Click(Sender: TObject);
var
rta: string;
z: integer;
par: TIdMultiPartFormDataStream;
begin
if sEdit1.text = '' then
begin
ShowMessage('Write the target');
end
else
begin
sStatusBar1.Panels[0].text := '[+] Getting IP ...';
Form1.sStatusBar1.Update;
par := TIdMultiPartFormDataStream.Create;
par.AddFormField('DOMAINNAME', sEdit1.text);
rta := IdHTTP1.Post('http://whatismyipaddress.com/hostname-ip', par);
PerlRegEx1.Regex := 'Lookup IP Address: <a href=(.*)>(.*)<\/a>';
PerlRegEx1.Subject := rta;
if PerlRegEx1.Match then
begin
sEdit1.text := PerlRegEx1.SubExpressions[2];
// Locating ...
sStatusBar1.Panels[0].text := '[+] Locating ...';
Form1.sStatusBar1.Update;
rta := IdHTTP1.Get(
'http://www.melissadata.com/lookups/iplocation.asp?ipaddress=' +
sEdit1.text);
PerlRegEx1.Regex := 'City<\/td><td align=(.*)><b>(.*)<\/b><\/td>';
PerlRegEx1.Subject := rta;
if PerlRegEx1.Match then
begin
sEdit2.text := PerlRegEx1.SubExpressions[2];
end
else
begin
sEdit2.text := 'Not Found';
end;
PerlRegEx1.Regex := 'Country<\/td><td align=(.*)><b>(.*)<\/b><\/td>';
PerlRegEx1.Subject := rta;
if PerlRegEx1.Match then
begin
sEdit3.text := PerlRegEx1.SubExpressions[2];
end
else
begin
sEdit3.text := 'Not Found';
end;
PerlRegEx1.Regex :=
'State or Region<\/td><td align=(.*)><b>(.*)<\/b><\/td>';
PerlRegEx1.Subject := rta;
if PerlRegEx1.Match then
begin
sEdit4.text := PerlRegEx1.SubExpressions[2];
end
else
begin
sEdit4.text := 'Not Found';
end;
//
// Get DNS
sStatusBar1.Panels[0].text := '[+] Getting DNS ...';
Form1.sStatusBar1.Update;
sListBox1.Items.Clear;
rta := IdHTTP1.Get('http://www.ip-adress.com/reverse_ip/' + sEdit1.text);
PerlRegEx1.Regex := 'whois\/(.*?)\">Whois';
PerlRegEx1.Subject := rta;
while PerlRegEx1.MatchAgain do
begin
for z := 1 to PerlRegEx1.SubExpressionCount do
sListBox1.Items.Add(PerlRegEx1.SubExpressions[z]);
end;
//
end
else
begin
sStatusBar1.Panels[0].text := '[-] Error';
Form1.sStatusBar1.Update;
end;
sStatusBar1.Panels[0].text := '';
Form1.sStatusBar1.Update;
end;
end;
end.
// The End ?
Si lo quieren bajar lo pueden hacer de aca (https://sourceforge.net/projects/locateipx/).