> On Mon, 6 Sep 2004, Jeff Chan wrote:
> 
> Guys, slightly on the subject of the previous -- has anyone 
> come across a reliable way to parse WHOIS data?  I've found a 
> minimally supported perl module, but I'm basically looking 
> for info on domain expiration (and
> creation) rather than anything else, as domain new-ness in 
> terms of email is a valuable factor in spammyness (as well as 
> having useful non-spam-fighting applications).
> 

I just added that support into the SURBL+ Checker tool at
http://www.rulesemporium.com/cgi-bin/uribl.cgi. The bad thing is every
registrar stores their domain creation date differently, and uses a
different headings for it.  

I use the following perl code to grab creation date currently..  It's
not fool-proof, but it's better than nothing.  Obviously there is no
date conversion code to convert everything to a common format (ie
YYYY-MM-DD).. My belief is that would be a pretty major undertaking
looking at some of the wacked out formats that the various registrars
return.

       use Net::Whois::Raw qw( whois );

       my @s;
       my $created;
       eval {
         @s =split (/\n/,whois($domain));
       };
       if ($@) {
#         &debug("whois lookup error: $@");
       }
       else {
        foreach my $l (@s) {
          if ($l =~ m/.*(creat(ed|ion)|regist(ered|ration))
(on|date):?\s*(.*)/i) {
            $created=$5;
          }
          if (!defined $created && $l =~ m/.*created:?(.*)/i) {
            $created=$1;
          }
        }
       }

Reply via email to