Advertisement
opexxx

robtex.pl

Feb 5th, 2014
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 2.07 KB | None | 0 0
  1. #!/usr/bin/perl -w
  2. ## Perl script interfaces with robtex.com to gather reverse IP data
  3. ##Will accept domain/IP as input
  4. ## usage
  5. ## ./robtex.pl google.com
  6. ## Updated on 10/14/2010
  7.  
  8. use LWP::Simple;
  9. use LWP::UserAgent;
  10. use Data::Dumper;
  11.  
  12.  
  13. my $input = $ARGV[0];
  14. my $url ='http://www.robtex.com/ip/';
  15.  
  16. my $ua = new LWP::UserAgent;
  17. $ua->agent("Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1");
  18.  
  19.  
  20. my $ns = "/usr/bin/nslookup";
  21.  
  22.  
  23. if ($input =~ m/([\d\.]{7,})/){
  24.         my $req = new HTTP::Request GET => ($url.$input.'.rss');
  25.         my $res = $ua->request($req);
  26.         my $robtex = $res->content;
  27.         print "\n\n"."Fetching Domains for"."\n".$input."\n\n";
  28.         if (defined $robtex){
  29.  
  30.         if ($robtex =~ m/\<span\sid\=\"sharedha\"\>Host\snames\ssharing\sIP\swith\sA\srecords\s(\(.*?\))\<\/span\>/g){
  31.                 print "Host names sharing IP with A records $1\n\n";
  32.         }
  33.  
  34.         if ($robtex =~ m/<span\s+id\=\"sharedha\">(.*?)\<\/div\>/ism ) {
  35.                 $sharedDomains = $1;
  36.                 while($sharedDomains =~ m/<a\s+href\=\"\/dns\/.*?\.html\#shared\"\s+>(.*?)<\/a>/ig ){
  37.                         print $1."\n";
  38.                 }
  39.         }
  40. }
  41.  
  42. }
  43. elsif ($input !~ m/([\d\.]{7,})/){
  44.         $ns .= " " . $input;
  45.         $rs = `$ns`;
  46.         if ($rs =~ m/Address\:\s+([\d\.]{7,})\s/){
  47.                 print "\n$input resolves to $1\n\n";
  48.                 my $req = new HTTP::Request GET => ($url.$1.'.rss');
  49.                 my $res = $ua->request($req);
  50.                 my $robtex = $res->content;
  51.         if (defined $robtex){
  52.  
  53.         if ($robtex =~ m/\<span\sid\=\"sharedha\"\>Host\snames\ssharing\sIP\swith\sA\srecords\s(\(.*?\))\<\/span\>/g){
  54.                 print "Host names sharing IP with A records $1\n\n";
  55.         }
  56.  
  57.         if ($robtex =~ m/\<span\s+id\=\"sharedha\"\>(.*?)\<\/div\>/ism ) {
  58.                 $sharedDomains = $1;
  59.                 while($sharedDomains =~ m/<a\s+href\=\"\/dns\/.*?\.html\#shared\"\s+>(.*?)<\/a>/ig ){
  60.                         print $1."\n";
  61.                 }
  62.         }
  63. }
  64.  
  65.         }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement