#!/usr/bin/perl -w # a simple script to sort out the # websites passed back to you # when using their reverse ip # tool to make it so it gives you # direct links to the websites to # make your life a little easier # use strict; use LWP::UserAgent; use HTTP::Headers; use Getopt::Long; my ( $ip, $data, $output, $http, $i ); my $options = { i => \$ip, o => \$output }; my $nextPage = 1; my $currPage = 1; my $found = 0; my $error = 0; GetOptions( $options, "i=s", "o:s" ); &usage unless $ip; if ( !$output ) { $output = "reverse.html"; } do { if ( $ip =~ /[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}.*/ ) { $http = LWP::UserAgent->new() or die; $http->agent("Mozilla/5.0 (Windows; U; Windows NT 5.1; us-EN; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.1"); $data = $http->get("http://whois.webhosting.info/$ip?pi=$currPage&ob=SLD&oo=ASC"); if ( $data->is_success ) { my $html = $data->content; my @matches = $html =~ /whois.webhosting.info\/(.*)\."/g; if ( !@matches ) { if ( $html =~ /The IP Address entered by you is InValid !!/ ) { print "no no.. we need a REAL ip\n"; $error = 1; } elsif ( $html =~ /N\/A/ && $found <= 0 ) { print "no domains are hosted on this ip\n"; $error = 1; } elsif ( $html =~ /The security key helps us prevent automated searches. This is not your password./ ) { print "they're asking for captcha, go open your browser and type it in\n"; $error = 1; } elsif ( $html =~ /N\/A/ && $found >= 1 ) { print "END OF DOMAIN LISTING\n"; $error = 1; } } else{ open( FILE, ">>$output" ); foreach my $parse (@matches) { if (@matches) { $parse = lc($parse); print FILE "$parse
\n"; $found++; } } } } } else { print "enter a IP, that means 4 octets numbers only..\n"; exit; } $currPage++; } while ( $nextPage == 1 && $error != 1 ); sub usage { print "whois.webhosting.info reverse ip parser\n"; print "usage: perl $0 -io\n\n"; print " -i\t\tip to run a reverse ip lookup on\n"; print " -o\t\tfile to output the results to (default: reverse.html\n"; exit; }