NAME
Net::Whois::IP - Perl extension for looking up the whois information for ip addresses
SYNOPSIS
use Net::Whois::IP qw(whoisip_query);
my $ip = "192.168.1.1";
my ($response, $array_of_responses) =
whoisip_query($ip,
$optional_registry,
$optional_multiple_flag,
$optional_raw_flag,
$optional_array_of_search_options);
In scalar context (single response hash returned):
my $response = whoisip_query($ip);
The response will be a reference to a hash containing all information provided by the whois registrar.
In list context (response hash and response chain returned):
my ($response, $array_of_responses) = whoisip_query($ip,
undef,
"true");
N.B.: See NOTES, below.
The array_of_responses is a reference to an array containing references to hashes for each level of query performed. For example, many records must be searched several times to obtain the most detailed information; this array contains the responses from each level.
If $optional_multiple_flag is not undef, all duplicate values for a given field will be returned.
For example, normally only the last instance of TechPhone will be returned if a record contains more than one. However, setting this flag to a non-undef value will return all values as an array.
As a consequence, all returned field values in the response hash become references to arrays and must be dereferenced before use.
If $optional_raw_flag is not undef, the response will be a reference to an array containing the raw responses from the registrar instead of a reference to a hash. In raw mode, no parsed response chain is returned.
If $optional_array_of_search_options is not undef, the first two entries will be used to replace TechPhone and OrgTechPhone in the search method. This is fairly dangerous and can cause the module not to work at all if set incorrectly.
Normal unwrap of $response ($optional_multiple_flag not set):
my $response = whoisip_query($ip);
foreach (sort keys(%{$response}) ) {
print "$_ $response->{$_} \n";
}
$optional_multiple_flag set to a value:
my $response = whoisip_query($ip, undef, "true");
foreach ( sort keys %$response ) {
print "$_ is\n";
foreach ( @{ $response->{ $_ } } ) { print " $_\n"; }
}
$optional_raw_flag set to a value:
my $response = whoisip_query( $ip, undef, undef, "true");
foreach (@{$response}) { print $_; }
$optional_array_of_search_options set but not $optional_multiple_flag or $optional_raw_flag:
my $search_options = ["NetName","OrgName"];
my $response = whoisip_query($ip, undef, undef, undef, $search_options);
foreach (sort keys(%{$response}) ) { print "$_ $response->{$_} \n"; }
TESTING
Some tests perform live WHOIS queries and therefore require outbound TCP connectivity to WHOIS servers on port 43.
When running under automated smoke-testing environments (AUTOMATED_TESTING), live-query tests are skipped only if port 43 connectivity is unavailable. This allows automated test systems with working WHOIS access to exercise the live query functionality while avoiding false failures on systems that restrict outbound WHOIS traffic.
Local development and manual testing are unaffected.
NOTES
For certain ARIN queries, additional synthesized parent/ancestor records may be prepended to the returned WHOIS response array ($array_of_responses). These records are synthesized from ARIN summary/hierarchy output and are normalized into standard WHOIS response hash format where possible.
Synthesized parent/ancestor records are tagged with the key "Synthetic", currently containing the value "ARIN-SUMMARY".
Because ARIN summary records are abbreviated, synthesized records may contain fewer fields than full WHOIS responses.
DESCRIPTION
Perl module to allow whois lookup of ip addresses. This module should recursively query the various whois providers until it gets more detailed information including either TechPhone or OrgTechPhone by default; however, this is overrideable.
AUTHOR
Ben Schmitz -- ben@foink.com
Thanks to Orbitz for allowing the community access to this work
Please email me any suggestions, complaints, etc.
SEE ALSO
perl(1). Net::Whois