diff options
Diffstat (limited to 'whoseip/whoseip.pl')
-rw-r--r-- | whoseip/whoseip.pl | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/whoseip/whoseip.pl b/whoseip/whoseip.pl index d5f58d0..78f7f8a 100644 --- a/whoseip/whoseip.pl +++ b/whoseip/whoseip.pl @@ -207,6 +207,24 @@ use constant RIPE_INIT => 0; use constant RIPE_TEXT => 1; use constant RIPE_IGNR => 2; +sub ripe_fmt { + # From the RIPE Database FAQ: + # + # Q: Why did I receive an Error 201: Access Denied? + # + # * You (or your application) performed too many queries that + # returned contact information (e.g. person or role objects) from the + # RIPE Database. There is a daily limit on the amount of personal + # data returned as described in the Acceptable Use Policy. + # + # * Even if you queried for other types of objects, the associated + # contact information is returned by default. To avoid this situation + # please use the "-r" flag to prevent any associated contact + # information from being returned. + my $q = shift; + return "-r $q"; +} + sub ripe_decode { my ($input, $ref) = @_; @@ -364,7 +382,7 @@ sub nobistech_decode { my %srvtab = ( 'whois.arin.net' => { q => \&arin_fmt, d => \&arin_decode }, 'whois.lacnic.net' => { d => \&lacnic_decode }, - 'whois.ripe.net' => { d => \&ripe_decode }, + 'whois.ripe.net' => { q => \&ripe_fmt, d => \&ripe_decode }, 'rwhois.gin.ntt.net' => { d => \&ntt_decode }, 'whois.twnic.net' => { d => \&twnic_decode }, 'whois.nic.ad.jp' => { q => \&nic_ad_jp_fmt, d => \&nic_ad_jp_decode }, @@ -665,6 +683,7 @@ sub docgi { my $output_format; my $fastcgi; my $single_query; +my $cache_ttl; if (defined($ENV{WHOSEIP_CONF})) { read_config_file($ENV{WHOSEIP_CONF}); @@ -701,12 +720,13 @@ GetOptions("h" => sub { "fastcgi:s" => \$fastcgi, "cache-file|c:s" => \$dbfile, "no-cache|N" => sub { $dbfile = undef; }, - "single-query" => \$single_query + "single-query" => \$single_query, + "cache-ttl|ttl|t=n" => \$cache_ttl, ) or exit(EX_USAGE); if (defined($dbfile)) { $dbfile .= "whoseip.db" if (-d $dbfile); - $dbf = ipdb_open($dbfile, debug => $debug); + $dbf = ipdb_open($dbfile, debug => $debug, ttl => $cache_ttl); } if (defined($fastcgi)) { |