#!/usr/bin/perl -w use strict; my $arin="/usr/bin/whois -h whois.arin.net"; my $ripe="/usr/bin/whois -h whois.ripe.net"; my $apnic="/usr/bin/whois -h whois.apnic.net"; my $krnic="/usr/bin/whois -h whois.krnic.net"; my $result; # Think about passingthese as params my $ips = "203.197.64.42"; whois($ips); sub whois{ my $ip = shift; $result = `$arin $ip`; if ($result =~ m/European Regional Internet Registry/){ $result = `$ripe $ip`; } elsif ($result =~ m/Asia Pacific Network Information Center/){ $result = `$apnic $ip`; if($result !~ m/hostmaster\@apnic.net/){ $result = `$krnic $ip` if $result =~ m/Allocated to KRNIC Member/; } } elsif{ handles($arin) } print "Can not perform a whois query for $ip\n;" unless match(); } sub match { my ($email, $domain) = $result =~ m/([-.\w]+)(\@[-.\w]+)/; print "The 1st email address is: $email$domain\n"; print "Email will also be sent to: abuse$domain\n"; } sub handles { # Obtain the handles from a whois query my $registry = shift; $result =~ m/xxx/; # Seems to do nothing. my @handle = $result =~ m/\((.*?)\)/g; # Create array to get second match. $result = `$registry $handle[1]`; }