0 Members and 1 Guest are viewing this topic.
// LocateIP 0.5// (C) Doddy Hackman 2014// Credits :// 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/// Thanks to whatismyipaddress.com , www.melissadata.com , www.ip-adress.comunit locate;interfaceuses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ComCtrls, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdHTTP, PerlRegEx, IdMultipartFormData, Vcl.Imaging.pngimage, Vcl.ExtCtrls;type TForm1 = class(TForm) GroupBox1: TGroupBox; Edit1: TEdit; Button1: TButton; GroupBox2: TGroupBox; Edit2: TEdit; Edit3: TEdit; Edit4: TEdit; StatusBar1: TStatusBar; Label1: TLabel; Label2: TLabel; Label3: TLabel; IdHTTP1: TIdHTTP; Image1: TImage; GroupBox3: TGroupBox; ListBox1: TListBox; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;var Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);var regex: TPerlRegEx; par: TIdMultiPartFormDataStream; rta: string; z: integer;begin regex := TPerlRegEx.Create(); par := TIdMultiPartFormDataStream.Create; par.AddFormField('DOMAINNAME', Edit1.text); StatusBar1.Panels[0].text := '[+] Getting IP ...'; Form1.StatusBar1.Update; rta := IdHTTP1.Post('http://whatismyipaddress.com/hostname-ip', par); regex.regex := 'Lookup IP Address: <a href=(.*)>(.*)<\/a>'; regex.Subject := rta; if regex.Match then begin Edit1.text := regex.Groups[2]; StatusBar1.Panels[0].text := '[+] Locating ...'; Form1.StatusBar1.Update; rta := IdHTTP1.Get ('http://www.melissadata.com/lookups/iplocation.asp?ipaddress=' + Edit1.text); regex.regex := 'City<\/td><td align=(.*)><b>(.*)<\/b><\/td>'; regex.Subject := rta; if regex.Match then begin Edit2.text := regex.Groups[2]; end else begin Edit2.text := 'Not Found'; end; regex.regex := 'Country<\/td><td align=(.*)><b>(.*)<\/b><\/td>'; regex.Subject := rta; if regex.Match then begin Edit3.text := regex.Groups[2]; end else begin Edit3.text := 'Not Found'; end; regex.regex := 'State or Region<\/td><td align=(.*)><b>(.*)<\/b><\/td>'; regex.Subject := rta; if regex.Match then begin Edit4.text := regex.Groups[2]; end else begin Edit4.text := 'Not Found'; end; StatusBar1.Panels[0].text := '[+] Getting DNS ...'; Form1.StatusBar1.Update; ListBox1.Items.Clear; rta := IdHTTP1.Get('http://www.ip-adress.com/reverse_ip/' + Edit1.text); regex.regex := 'whois\/(.*?)\">Whois'; regex.Subject := rta; while regex.MatchAgain do begin for z := 1 to regex.GroupCount do ListBox1.Items.Add(regex.Groups[z]); end; end else begin StatusBar1.Panels[0].text := '[-] Error'; Form1.StatusBar1.Update; end; StatusBar1.Panels[0].text := '[+] Finished'; Form1.StatusBar1.Update; regex.Free;end;end.// The End ?
Not bad, but a command line tool of this would be much more useful...