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.

¤


In reply to Re: How to Ignore an email address with this script. by frankus
in thread How to Ignore an email address with this script. by dru145

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.