in reply to How to Ignore an email address with this script.
How about Procmail?... Ah, you want to mung data from whois :)
/me hopes the names, phone numbers etc. have been changed to protect the innocent.
OK, I'll profess to only understanding a little of why you're
posting this, is it a CUFP?,
it'd really help us and your future
self to use comments to describe the process being
undertaken and indent subroutines too, okay lecture over,
sorry if you didn't need to hear it ;)
I've altered the code to make it fit in a smaller space and hopefully be more legible,
I've trimmed the logic processes, but not tested it, so it's clearer to me and anyone who follows: what it is you're doing:
#!/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 Me +mber/; } } 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]`; }
--
Brother Frankus.
¤
|
|---|