@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
use strict;
use Module::Build;
@@ -499,16 +499,56 @@ Revision history for Perl module Net::Whois::Raw.
2.50 Jan 13 2014 Alexander Nalobin
- Handling exceed limits of whois.nic.cz
+ - IO whois updated.
+ - BY whois added.
2.51 Jan 16 2014 Victor Efimov
- RT#60339 fixed regexp for parsing .TJ web whois
- RT#64960 extend regexp for ReferralServer parsing (for recursive whois)
- Several timeout/alarm issues:
- Fix race-condition between ALRM handler cleared and
- alarm timer cleared (could result process to exit with signalal - i.e. not possible
- to catch as die(), and no destructions called).
- Fix action-at-distance - we were clearing alarm timer to zero, if alarm is
- not used (i.e if TIMEOUT zero).
- Substract time spent in request from outer alarm
+ Fix race-condition between ALRM handler cleared and
+ alarm timer cleared (could result process to exit with signalal - i.e.
+ not possible to catch as die(), and no destructions called).
+ Fix action-at-distance - we were clearing alarm timer to zero, if alarm is
+ not used (i.e if TIMEOUT zero).
+ Substract time spent in request from outer alarm
- Fixed: unicode whois was damaging when using caching
- Under POSIX systems pwhois now uses TMPDIR env, not TEMP.
+ Under POSIX systems pwhois now uses TMPDIR env, not TEMP.
+
+2.52 Jan 24 2014 Alexander Nalobin
+ - Handling exceed limits of whois.name.com
+ and in recursive queries ( set $CHECK_EXCEED = 2 )
+
+2.53 Feb 07 2014 Alexander Nalobin
+ - TODAY whois server added
+
+2.54 Feb 18 2014 Dmitriy Seluzhitskiy
+ - Add whois server for gtld, managed by Sugar Glen, LLC (http://donuts.co)
+
+2.55 Feb 24 2014 Alexander Nalobin
+ - RT#91930 Boilerplate stripping
+
+2.56 Feb 25 2014 Anton Chuvashev
+ - new tlds XN--D1ACJ3B, XN--80ASWG, XN--80ASEHDB
+
+2.57 Feb 25 2014 Victor Efimov
+ - Fix whois server for .BZ
+
+2.58 Mar 12 2014 Dmitriy Seluzhitskiy
+ - Add whois servers for gtld: .berlin
+
+2.59 Mar 12 2014 Dmitriy Seluzhitskiy
+ - Fixed .domains whois error
+
+2.60 Mar 21 2014 Dmitriy Shamatrin
+ - Added query suffix
+ - Added timeout to 02-internet.t for hangs prevention
+
+2.61 Apr 02 2014 Dmitriy Seluzhitskiy
+ - Add zones for whois.uniregistry.net
+
+2.62 Apr 16 2014 Dmitriy Seluzhitskiy
+ - Add whois.dot-kiwi.com for .KIWI
+
+2.63 Apr 17 2014 Dmitriy Seluzhitskiy
+ - Add whois.nic.build for .BUILD
@@ -1,20 +1,33 @@
{
- "abstract" : "Get Whois information for domains",
- "author" : [],
+ "abstract" : "unknown",
+ "author" : [
+ "unknown"
+ ],
"dynamic_config" : 1,
- "generated_by" : "Module::Build version 0.4202",
+ "generated_by" : "ExtUtils::MakeMaker version 6.94, CPAN::Meta::Converter version 2.131560",
"license" : [
- "perl_5"
+ "unknown"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
"version" : "2"
},
"name" : "Net-Whois-Raw",
+ "no_index" : {
+ "directory" : [
+ "t",
+ "inc"
+ ]
+ },
"prereqs" : {
+ "build" : {
+ "requires" : {
+ "ExtUtils::MakeMaker" : "0"
+ }
+ },
"configure" : {
"requires" : {
- "Module::Build" : "0.42"
+ "ExtUtils::MakeMaker" : "0"
}
},
"runtime" : {
@@ -28,28 +41,10 @@
"Net::IDN::Punycode" : "1",
"Regexp::IPv6" : "0",
"Test::More" : "0",
- "URI::URL" : "0",
- "perl" : "5.008001"
+ "URI::URL" : "0"
}
}
},
- "provides" : {
- "Net::Whois::Raw" : {
- "file" : "lib/Net/Whois/Raw.pm",
- "version" : "2.51"
- },
- "Net::Whois::Raw::Common" : {
- "file" : "lib/Net/Whois/Raw/Common.pm"
- },
- "Net::Whois::Raw::Data" : {
- "file" : "lib/Net/Whois/Raw/Data.pm"
- }
- },
"release_status" : "stable",
- "resources" : {
- "license" : [
- "http://dev.perl.org/licenses/"
- ]
- },
- "version" : "2.51"
+ "version" : "2.63"
}
@@ -1,25 +1,22 @@
---
-abstract: 'Get Whois information for domains'
+abstract: unknown
author:
- unknown
-build_requires: {}
+build_requires:
+ ExtUtils::MakeMaker: 0
configure_requires:
- Module::Build: 0.42
+ ExtUtils::MakeMaker: 0
dynamic_config: 1
-generated_by: 'Module::Build version 0.4202, CPAN::Meta::Converter version 2.132830'
-license: perl
+generated_by: 'ExtUtils::MakeMaker version 6.94, CPAN::Meta::Converter version 2.131560'
+license: unknown
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
name: Net-Whois-Raw
-provides:
- Net::Whois::Raw:
- file: lib/Net/Whois/Raw.pm
- version: 2.51
- Net::Whois::Raw::Common:
- file: lib/Net/Whois/Raw/Common.pm
- Net::Whois::Raw::Data:
- file: lib/Net/Whois/Raw/Data.pm
+no_index:
+ directory:
+ - t
+ - inc
requires:
Encode: 0
File::Temp: 0
@@ -31,7 +28,4 @@ requires:
Regexp::IPv6: 0
Test::More: 0
URI::URL: 0
- perl: 5.008001
-resources:
- license: http://dev.perl.org/licenses/
-version: 2.51
+version: 2.63
@@ -1,6 +1,6 @@
NAME
Net::Whois::Raw - Get Whois information for domains
-
+
SYNOPSIS
use Net::Whois::Raw;
@@ -99,6 +99,8 @@ sub process_whois {
}
}
+ $whois = _strip_trailer_lines( $whois ) if $OMIT_MSG;
+
if ( $CHECK_FAIL || $OMIT_MSG ) {
my %notfound = %Net::Whois::Raw::Data::notfound;
@@ -151,6 +153,17 @@ sub process_whois {
return $whois, undef;
}
+# Tries to strip trailer lines of whois
+sub _strip_trailer_lines {
+ my ( $whois ) = @_;
+
+ for my $re ( @Net::Whois::Raw::Data::strip_regexps ) {
+ $whois =~ s/$re/$1/;
+ }
+
+ return $whois;
+}
+
# get whois-server for domain / tld
sub get_server {
my ($dom, $is_ns, $tld) = @_;
@@ -16,6 +16,10 @@ our %servers = qw(
RU whois.ripn.net
SU whois.ripn.net
XN--P1AI whois.ripn.net
+ XN--D1ACJ3B whois.ripn.net
+
+ XN--80ASWG whois.online.rs.corenic.net
+ XN--80ASEHDB whois.online.rs.corenic.net
COM.RU whois.nic.ru
NET.RU whois.nic.ru
@@ -142,6 +146,95 @@ our %servers = qw(
TEL whois-tel.neustar.biz
TRAVEL whois.nic.travel
+ VENTURES whois.donuts.co
+ SINGLES whois.donuts.co
+ BIKE whois.donuts.co
+ HOLDINGS whois.donuts.co
+ PLUMBING whois.donuts.co
+ GURU whois.donuts.co
+ CLOTHING whois.donuts.co
+ CAMERA whois.donuts.co
+ EQUIPMENT whois.donuts.co
+ ESTATE whois.donuts.co
+ GALLERY whois.donuts.co
+ GRAPHICS whois.donuts.co
+ LIGHTING whois.donuts.co
+ PHOTOGRAPHY whois.donuts.co
+ CONTRACTORS whois.donuts.co
+ LAND whois.donuts.co
+ TECHNOLOGY whois.donuts.co
+ CONSTRUCTION whois.donuts.co
+ DIRECTORY whois.donuts.co
+ KITCHEN whois.donuts.co
+ TODAY whois.donuts.co
+ DIAMONDS whois.donuts.co
+ ENTERPRISES whois.donuts.co
+ TIPS whois.donuts.co
+ VOYAGE whois.donuts.co
+ SHOES whois.donuts.co
+ CAREERS whois.donuts.co
+ PHOTOS whois.donuts.co
+ RECIPES whois.donuts.co
+ LIMO whois.donuts.co
+ DOMAINS whois.donuts.co
+ CAB whois.donuts.co
+ COMPANY whois.donuts.co
+ COMPUTER whois.donuts.co
+ CENTER whois.donuts.co
+ SYSTEMS whois.donuts.co
+ ACADEMY whois.donuts.co
+ MANAGEMENT whois.donuts.co
+ TRAINING whois.donuts.co
+ SOLUTIONS whois.donuts.co
+ SUPPORT whois.donuts.co
+ BUILDERS whois.donuts.co
+ EMAIL whois.donuts.co
+ EDUCATION whois.donuts.co
+ INSTITUTE whois.donuts.co
+ REPAIR whois.donuts.co
+ CAMP whois.donuts.co
+ GLASS whois.donuts.co
+ SOLAR whois.donuts.co
+ COFFEE whois.donuts.co
+ INTERNATIONAL whois.donuts.co
+ HOUSE whois.donuts.co
+ FLORIST whois.donuts.co
+ HOLIDAY whois.donuts.co
+ MARKETING whois.donuts.co
+ VIAJES whois.donuts.co
+ FARM whois.donuts.co
+ CODES whois.donuts.co
+ CHEAP whois.donuts.co
+ ZONE whois.donuts.co
+ AGENCY whois.donuts.co
+ BARGAINS whois.donuts.co
+ BOUTIQUE whois.donuts.co
+ COOL whois.donuts.co
+ WATCH whois.donuts.co
+ WORKS whois.donuts.co
+ EXPERT whois.donuts.co
+ FOUNDATION whois.donuts.co
+ EXPOSED whois.donuts.co
+ VILLAS whois.donuts.co
+ FLIGHTS whois.donuts.co
+ RENTALS whois.donuts.co
+ CRUISES whois.donuts.co
+ VACATIONS whois.donuts.co
+
+ SEXY whois.uniregistry.net
+ TATTOO whois.uniregistry.net
+ LINK whois.uniregistry.net
+ GUITARS whois.uniregistry.net
+ GIFT whois.uniregistry.net
+ PICS whois.uniregistry.net
+ PHOTO whois.uniregistry.net
+
+ MENU whois.nic.menu
+ UNO whois.nic.uno
+ BERLIN whois.nic.berlin
+ KIWI whois.dot-kiwi.com
+ BUILD whois.nic.build
+
TV whois.nic.tv
WS whois.worldsite.ws
NF whois.nic.cx
@@ -476,7 +569,7 @@ our %servers = qw(
BIZ.NS whois.biz
NAME.NS whois.nic.name
SO whois.nic.so
- BZ whois.enom.com
+ BZ whois2.afilias-grs.net
XXX whois.nic.xxx
);
@@ -561,6 +654,13 @@ our %notfound = (
'whois.registrypro.pro' => '^No match',
'whois.worldsite.ws' => 'No match for',
'whois.nic.travel' => 'Not found: \S+',
+ 'whois.donuts.co' => 'Domain not found',
+ 'whois.nic.menu' => 'No Data Found',
+ 'whois.uniregistry.net' => 'No match for',
+ 'whois.nic.uno' => 'Not found:',
+ 'whois.nic.berlin' => 'No match',
+ 'whois.dot-kiwi.com' => 'Status\: Not Registered',
+ 'whois.nic.build' => 'No Data Found',
'whois.nic.ag' => 'NOT FOUND',
'whois.nic.as' => 'Domain Not Found',
@@ -721,6 +821,21 @@ our %notfound = (
'www_whois' => '(Available|no records found|is free|Not Registered)',
'whois.nic.xxx' => 'NOT FOUND',
+
+ 'whois.online.rs.corenic.net' => 'no matching objects found',
+);
+
+# Common whois stripping REs
+our @strip_regexps = (
+ qr{
+ (.+)
+ ^ (?:
+ \W* Last \s update \s of \s WHOIS \s database
+ | Database \s last \s updated
+ | \W* Whois \s database \s was \s last \s updated \s on
+ )
+ \b .+ \z
+ }xmsi,
);
our %strip = (
@@ -734,6 +849,10 @@ our %strip = (
'^%',
],
+ 'whois.nic.berlin' => [
+ '^%',
+ ],
+
'whois.ripn.net' => [
'^%',
@@ -2028,6 +2147,49 @@ our %strip = (
'^NOTE: FAILURE TO LOCATE A RECORD',
'^OF THE AVAILABILITY OF A DOMAIN NAME',
],
+ 'whois.donuts.co' => [
+ '^Terms of Use:',
+ '>>> Last update of WHOIS database',
+ ],
+
+ 'whois.uniregistry.net' => [
+ '>>> Last update of WHOIS database',
+ '^Access to WHOIS information',
+ '^This service is intended only',
+ '^[^A-Z]',
+ '^\s+$'
+ ],
+
+ 'whois.nic.uno' => [
+ '^>>>> Whois database was last updated',
+ '^The WHOIS service offered by Dot Latin LLC',
+ '^By executing a query',
+ '^NOTE: FAILURE TO LOCATE A RECORD',
+ '^All domain names are subject to certain',
+ ],
+
+ 'whois.nic.menu' => [
+ '>>> Last update of WHOIS database',
+ '^The data contained in Wedding TLD2',
+ '^This information is provided',
+ '^By submitting an inquiry',
+ '^You further agree not to use',
+ '^Wedding TLD2, LLC reserves',
+ ],
+
+ 'whois.dot-kiwi.com' => [
+ '^>>> Last update',
+ '^TERMS OF USE:',
+ '^The data',
+ '^[^A-Z]',
+ ],
+
+ 'whois.nic.build' => [
+ '^>>> Last update of WHOIS database',
+ '^The data',
+ '^[^A-Z]',
+ ],
+
'whois.nic.ht' => [
'^TERMS OF USE: You are not authorized',
'^database through the use of electronic',
@@ -2163,6 +2325,9 @@ our %strip = (
'^the right to modify these terms at any time. By submitting this query,',
'^you agree to abide by this policy.',
],
+ 'whois.online.rs.corenic.net' => [
+ '^%',
+ ],
);
our %exceed = (
@@ -2184,6 +2349,7 @@ our %exceed = (
'whois.nic.li' => 'You have exceeded this limit',
'whois.nic.ch' => 'You have exceeded this limit',
'whois.nic.cz' => 'Your connection limit exceeded',
+ 'whois.name.com' => 'Too many connection attempts. Please try again in a few seconds.',
);
our $default_ban_time = 60;
@@ -14,12 +14,15 @@ use utf8;
our @EXPORT = qw( whois get_whois );
-our $VERSION = '2.51';
+our $VERSION = '2.63';
our ($OMIT_MSG, $CHECK_FAIL, $CHECK_EXCEED, $CACHE_DIR, $TIMEOUT, $DEBUG) = (0) x 7;
+
our $CACHE_TIME = 60;
our $SET_CODEPAGE = '';
our $SILENT_MODE = 0;
+our $QUERY_SUFFIX = '';
+
our (%notfound, %strip, @SRC_IPS, %POSTPROCESS);
our $class = __PACKAGE__;
@@ -113,7 +116,7 @@ sub get_all_whois {
my ($dom, $srv, $norecurse) = @_;
my $is_ns = 0;
- $is_ns = 1 if $dom =~ s/.NS$//i;
+ $is_ns = 1 if $dom =~ s/[.]NS$//i;
$srv ||= Net::Whois::Raw::Common::get_server( $dom, $is_ns );
@@ -135,16 +138,19 @@ sub process_whois_answers {
my @processed_whois;
my $level = 0;
- foreach my $whois_rec (@{$raw_whois}) {
+ for my $whois_rec ( @$raw_whois ) {
$whois_rec->{level} = $level;
- my ($text, $error) = Net::Whois::Raw::Common::process_whois(
+ my ( $text, $error ) = Net::Whois::Raw::Common::process_whois(
$dom,
$whois_rec->{srv},
$whois_rec->{text},
$CHECK_FAIL, $OMIT_MSG, $CHECK_EXCEED,
);
- die $error if $level == 0 && $error && $error eq 'Connection rate exceeded';
- if ($text || $level == 0) {
+
+ die $error if $error && $error eq 'Connection rate exceeded'
+ && ( $level == 0 || $CHECK_EXCEED == 2 );
+
+ if ( $text || $level == 0 ) {
$whois_rec->{text} = $text;
push @processed_whois, $whois_rec;
}
@@ -285,6 +291,10 @@ sub whois_query {
print "Socket: ". Data::Dumper::Dumper($sock);
}
+ if ($QUERY_SUFFIX) {
+ $whoisquery .= $QUERY_SUFFIX;
+ }
+
$sock->print( $whoisquery, "\r\n" );
# TODO: $soc->read, parameters for read chunk size, max content length
# Now you can redefine SOCK_CLASS::getline method as you want
@@ -413,58 +423,63 @@ Net::Whois::Raw -- Get Whois information for domains
=head1 SYNOPSIS
- use Net::Whois::Raw;
+ use Net::Whois::Raw;
- $dominfo = whois('perl.com');
- ($dominfo, $whois_server) = whois('funet.fi');
- $reginfo = whois('REGRU-REG-RIPN', 'whois.ripn.net');
+ $dominfo = whois('perl.com');
+ ($dominfo, $whois_server) = whois('funet.fi');
+ $reginfo = whois('REGRU-REG-RIPN', 'whois.ripn.net');
- $arrayref = get_whois('yahoo.co.uk', undef, 'QRY_ALL');
- $text = get_whois('yahoo.co.uk', undef, 'QRY_LAST');
- ($text, $srv) = get_whois('yahoo.co.uk', undef, 'QRY_FIRST');
+ $arrayref = get_whois('yahoo.co.uk', undef, 'QRY_ALL');
+ $text = get_whois('yahoo.co.uk', undef, 'QRY_LAST');
+ ($text, $srv) = get_whois('yahoo.co.uk', undef, 'QRY_FIRST');
- $Net::Whois::Raw::OMIT_MSG = 1;
- # This will attempt to strip several known copyright
+ $Net::Whois::Raw::OMIT_MSG = 1;
+ # This will attempt to strip several known copyright
# messages and disclaimers sorted by servers.
# Default is to give the whole response.
- $Net::Whois::Raw::CHECK_FAIL = 1;
- # This will return undef if the response matches
+ $Net::Whois::Raw::CHECK_FAIL = 1;
+ # This will return undef if the response matches
# one of the known patterns for a failed search,
# sorted by servers.
# Default is to give the textual response.
- $Net::Whois::Raw::CHECK_EXCEED = 1;
- # When this option is set, "die" will be called
+ $Net::Whois::Raw::CHECK_EXCEED = 0 | 1 | 2;
+ # When this option is true, "die" will be called
# if connection rate to specific whois server have been
- # exceeded
+ # exceeded.
+ # If set to 2, will die in recursive queries too.
- $Net::Whois::Raw::CACHE_DIR = "/var/spool/pwhois/";
- # Whois information will be
+ $Net::Whois::Raw::CACHE_DIR = "/var/spool/pwhois/";
+ # Whois information will be
# cached in this directory. Default is no cache.
- $Net::Whois::Raw::CACHE_TIME = 60;
- # Cache files will be cleared after not accessed
+ $Net::Whois::Raw::CACHE_TIME = 60;
+ # Cache files will be cleared after not accessed
# for a specific number of minutes. Documents will not be
# cleared if they keep get requested for, independent
# of disk space.
- $Net::Whois::Raw::TIMEOUT = 10;
- # Cancel the request if connection is not made within
+ $Net::Whois::Raw::TIMEOUT = 10;
+ # Cancel the request if connection is not made within
# a specific number of seconds.
- @Net::Whois::Raw::SRC_IPS = (11.22.33.44);
- # List of local IP addresses to
- # use for WHOIS queries. Addresses will be used used
- # successively in the successive queries
+ @Net::Whois::Raw::SRC_IPS = (11.22.33.44);
+ # List of local IP addresses to
+ # use for WHOIS queries. Addresses will be used used
+ # successively in the successive queries
- $Net::Whois::Raw::POSTPROCESS{whois.crsnic.net} = \&my_func;
+ $Net::Whois::Raw::POSTPROCESS{whois.crsnic.net} = \&my_func;
# Call to a user-defined subroutine on whois result,
# depending on whois-server.
# Above is equil to:
# ($text, $srv) = whois('example.com');
# $text = my_func($text) if $srv eq 'whois.crsnic.net';
+ $Net::Whois::Raw::QUERY_SUFFIX = '/e';
+ # This will add specified suffix to whois query.
+ # It may be used for english output forcing.
+
=head1 DESCRIPTION
Net::Whois::Raw queries WHOIS servers about domains.
@@ -1,11 +1,12 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
use strict;
+use warnings;
-use Test::More tests => 26;
+use Test::More tests => 29;
-use_ok('Net::Whois::Raw');
-use_ok('Net::Whois::Raw::Common');
+use_ok 'Net::Whois::Raw';
+use_ok 'Net::Whois::Raw::Common';
ok( Net::Whois::Raw::Common::domain_level( 'reg.ru' ) == 2, 'domain_level' );
ok( Net::Whois::Raw::Common::domain_level(' www.reg.ru' ) == 3, 'domain_level' );
@@ -59,3 +60,33 @@ for ('ReferralServer: whois://some-host.com') {
my ($res) = Net::Whois::Raw::_referral_server();
is $res, 'some-host.com', "_referral_server should work for whois:// without port";
}
+
+is Net::Whois::Raw::Common::_strip_trailer_lines( q{
+blah-blah-blah
+
+>>> Last update of WHOIS database: 2014-02-24T04:01:25-0800 <<<
+
+The Data in MarkMonitor.com's WHOIS database is provided by MarkMonitor.com for
+ } ),
+ "\nblah-blah-blah\n\n", '_strip_trailer_lines';
+
+is Net::Whois::Raw::Common::_strip_trailer_lines( q{
+Record created on 24-Sep-1998
+Database last updated on 12-Sep-2013
+
+The Data in the Safenames Registrar WHOIS database is provided by Safenames for
+information purposes only, and to assist persons in obtaining information about
+or related to a domain name registration record. Safenames does not guarantee
+its accuracy. Additionally, the data may not reflect updates to billing
+contact information.} ),
+ "\nRecord created on 24-Sep-1998\n", '_strip_trailer_lines';
+
+
+is Net::Whois::Raw::Common::_strip_trailer_lines( q{
+Domain Last Updated Date: Sat Jun 04 15:25:01 GMT 2011
+
+>>>> Whois database was last updated on: Mon Feb 24 12:49:50 GMT 2014 <<<<
+
+NeuStar, Inc., the Registry Operator for .BIZ, has collected this information} ),
+ "\nDomain Last Updated Date: Sat Jun 04 15:25:01 GMT 2011\n\n",
+ '_strip_trailer_lines';
\ No newline at end of file
@@ -3,7 +3,9 @@
use strict;
use Data::Dumper;
-use Test::More tests => 10;
+use Test::More tests => 10;
+
+use constant ALRM_TIMEOUT => 10;
BEGIN {
use_ok('Net::Whois::Raw',qw( whois ));
@@ -23,6 +25,12 @@ my @domains = qw(
SKIP: {
print "The following tests requires internet connection. Checking...\n";
+
+ local $SIG{ALRM} = sub {
+ BAIL_OUT("Check your internet connection.\n");
+ };
+
+ alarm ALRM_TIMEOUT;
skip "Looks like no internet connection",
Test::More->builder->expected_tests() - 1 unless get_connected();
@@ -73,6 +81,7 @@ SKIP: {
unlink <$tmp_dir/*>;
rmdir $tmp_dir;
+ alarm 0;
};
sub get_connected {