#!C:\Perl\bin\perl.exe -w #!/usr/bin/perl -w ################################################################ print "Content-type: text/html\n\n"; print < Tools Console

Tools Console

ENDHTML &get_in_get_post_data; if (($post_in{'ip_lookup'}) || ($post_in{'hostname_lookup'}) || ($post_in{'whois'}) || ($post_in{'ip_whois'}) || ($post_in{'netcraft'}) || ($post_in{'get_html'})) { if ($post_in{'data'}) { if ($post_in{'ip_lookup'}) { &do_ip_address; } if ($post_in{'hostname_lookup'}) { &do_hostname; } if ($post_in{'whois'}) { &do_whois; } if ($post_in{'ip_whois'}) { &do_ip_whois; } if ($post_in{'netcraft'}) { &do_netcraft; } if ($post_in{'get_html'}) { &do_get_html; } } else { print "
Error no data
\n"; } } else { print <
IP Lookup:
Name Lookup:
Whois:
IP Whois:
Netcraft:

View HTML Headers/Body
URL:
User Agent:
Referrer:
ENDHTML } print < ENDHTML sub do_get_html { $get_html{'domain_name'} = $post_in{'data'}; unless ($get_html{'domain_name'} =~ /http:\/\//) { $get_html{'domain_name'}='http://'.$get_html{'domain_name'}; } if ($post_in{'data_http_useragent'}) { $get_html{'useragent'} = $post_in{'data_http_useragent'}; } else { $get_html{'useragent'} = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 4.0'; } if ($post_in{'data_http_referer'}) { $get_html{'referer'} = $post_in{'data_http_referer'}; } else { $get_html{'referer'} = '-'; } print "
\n";
    use LWP::UserAgent;
    my $ua = LWP::UserAgent->new();
    $ua->agent( $get_html{'useragent'} );
    $ua->timeout('1');
    
    my $req = HTTP::Request->new('GET' => $get_html{'domain_name'});
       $req->referer( $get_html{'referer'} );
       #$req->header('Accept' => 'text/html'); 
    my $res = $ua->request($req);

    if ($res->is_success) {

        $filter = $res->headers_as_string; &filter; $get_html{'headers_as_string'} = $filter;
        $filter = $res->code; &filter; $get_html{'code'} = $filter;
        $filter = $res->content; &filter; $get_html{'content'} = $filter;
        
        print "Code: $get_html{'code'}\n\n";
        print "Headers\n-------\n";
        print $get_html{'headers_as_string'};
        print "\n";
        print "Body\n----\n";
        print $get_html{'content'};
        print "\n";

    } else {
        $filter = $get_html{'domain_name'}; &filter; $get_html{'domain_name'} = $filter;
        print "Error can not get: $get_html{'domain_name'}\n";
    }
    print "
\n"; } sub do_ip_address { print "
\n";
    $ip_address{'domain_name'} = $post_in{'data'};
    $ip_address{'domain_name'} =~ s/^http:\/\///g;

    use Socket;
    $ip_address{'ip'} = gethostbyname($ip_address{'domain_name'});
    
    if (defined($ip_address{'ip'})) {
        $ip_address{'ip'} = inet_ntoa(scalar($ip_address{'ip'}));
        $filter = $ip_address{'domain_name'}; &filter; $ip_address{'domain_name'} = $filter;
        print "$ip_address{'domain_name'}: $ip_address{'ip'}\n";
    }
    else {
        $filter = $ip_address{'domain_name'}; &filter; $ip_address{'domain_name'} = $filter;
        print "Error can not get ip for $ip_address{'domain_name'}\n";
    }
    print "
\n"; } sub do_hostname { print "
\n";
    $hostname{'ip'} = $post_in{'data'};
    if ($hostname{'ip'} =~ m!(\d+)\.(\d+)\.(\d+)\.(\d+)!) {
        $hostname = (gethostbyaddr(pack('C4', $1, $2, $3, $4), 2))[0];
        $hostname = $hostname || 'no reverse DNS';
        print "$hostname{'ip'}: $hostname\n";
    } else {
        $filter = $hostname{'ip'}; &filter; $hostname{'ip'} = $filter;
        print "Not an IP address: $hostname{'ip'}\n";
    }
    print "
\n"; } sub do_ip_whois { $ip_whois{'ip'} = $post_in{'data'}; $ip_whois{'server'} = 'whois.arin.net'; print "
\n";
    &query_ip_whois;
    print "
\n"; $count=0; sub query_ip_whois { use IO::Socket; $socket = IO::Socket::INET->new(Proto=>"tcp", PeerAddr=>"$ip_whois{'server'}",PeerPort=>'43',); $whois{'domain_name'} =~ s/[^0-9\.]//g; if ($socket) { print $socket "$ip_whois{'ip'}" . "\015\012"; @data = <$socket>; close $socket; print "Whois: $ip_whois{'ip'}\n" unless $ip_whois{'redirect'}; $ip_whois{'redirect'}=''; foreach $line (@data) { $line =~ s/\r|\n//g; print "$line\n"; if ($line =~ /http:\/\/www\.ripe\.net\/whois/) { $ip_whois{'redirect'} = 'whois.ripe.net'; } if ($line =~ /http:\/\/www\.apnic\.net\//) { $ip_whois{'redirect'} = 'whois.apnic.net'; } } print "\n"; $count++; unless ($count > 1) { if ($ip_whois{'redirect'}) { print "Redirecting to: $ip_whois{'redirect'}\n"; $ip_whois{'server'}=$ip_whois{'redirect'}; &query_ip_whois; } } } else { print "Unable to connect to $ip_whois{'server'}\n"; } } } sub do_whois { $whois{'domain_name'} = $post_in{'data'}; $whois{'domain_name'} =~ s/^http:\/\///g; $whois{'domain_name'} =~ s/^www\.//g; if ($whois{'domain_name'} =~ /.uk/) { $whois{'server'} = "whois.nic.uk"; } elsif ($whois{'domain_name'} =~ /uk./) { $whois{'server'} = "whois.nomination.net"; } elsif ($whois{'domain_name'} =~ /info/) { $whois{'server'} = "whois.afilias.net"; } elsif ($whois{'domain_name'} =~ /biz/) { $whois{'server'} = "whois.nic.biz"; } elsif ($whois{'domain_name'} =~ /org/) { $whois{'server'} = "whois.publicinterestregistry.net"; } else { $whois{'server'} = "whois.crsnic.net"; } print "
\n";
    &query_whois;
    print "
\n"; $count=0; sub query_whois { use IO::Socket; $socket = IO::Socket::INET->new(Proto=>"tcp", PeerAddr=>"$whois{'server'}",PeerPort=>'43',); $whois{'domain_name'} =~ s/[^a-zA-Z0-9\.]//g; if ($socket) { print $socket "$whois{'domain_name'}" . "\015\012"; @data = <$socket>; close $socket; print "Whois: $whois{'domain_name'}\n" unless $whois{'redirect'}; $whois{'redirect'}=''; foreach $line (@data) { $line =~ s/\r|\n//g; print "$line\n"; if ($line =~ /Whois Server: /) { (my $null,$whois{'redirect'})=split(/Whois Server: /,$line); $whois{'redirect'} =~ s/[^a-zA-Z0-9\.]//g; } if ($line =~ /Whois Server:/) { (my $null,$whois{'redirect'})=split(/Whois Server:/,$line); $whois{'redirect'} =~ s/[^a-zA-Z0-9\.]//g; } } print "\n"; $count++; unless ($count > 1) { if ($whois{'redirect'}) { print "Redirecting to: $whois{'redirect'}\n"; $whois{'server'}=$whois{'redirect'}; &query_whois; } } } else { print "Unable to connect to $whois{'server'}\n"; } } } sub do_netcraft { $netcraft{'domain_name'} = $post_in{'data'}; $netcraft{'domain_name'} =~ s/[^a-zA-Z0-9\.\:\/]//g; print "Netcraft
\n"; } sub print_line { print "
--------------------------------------------------------------------------------------
\n\n"; } sub filter { $filter =~ s/\r//g; $filter =~ s/>/>/g; $filter =~ s/