Re: domains, top level, collecting a list of
- From: "John W. Krahn" <someone@xxxxxxxxxxx>
- Date: Tue, 29 Jan 2008 23:34:55 GMT
wardbayern@xxxxxxxxx wrote:
Is there a perl way, verses finding a published list, to collect
current top level domain names?
$ perl -MSocket -le'
# Search from 1.0.0.1 through 255.255.255.254
for ( my $ip = 16_777_217; $ip < 4_294_967_295; ++$ip ) {
# Skip 127.0.0.0 through 127.255.255.255
next if $ip >= 2_130_706_432 && $ip <= 2_147_483_647;
# Skip 10.0.0.0 through 10.255.255.255 -- RFC1918
next if $ip >= 167_772_160 && $ip <= 184_549_375;
# Skip 172.16.0.0 through 172.31.255.255 -- RFC1918
next if $ip >= 2_886_729_728 && $ip <= 2_887_778_303;
# Skip 192.168.0.0 through 192.168.255.255 -- RFC1918
next if $ip >= 3_232_235_520 && $ip <= 3_232_301_055;
$TLD{ lc( $1 ) }++ if gethostbyaddr( pack( "N", $ip ), AF_INET ) =~ /\.(\w+)\z/;
}
print for sort keys %TLD;
'
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
.
- References:
- domains, top level, collecting a list of
- From: wardbayern
- domains, top level, collecting a list of
- Prev by Date: Re: Using Imager module to resample images
- Next by Date: Re: uniq without sort <-------------- GURU NEEDED
- Previous by thread: Re: domains, top level, collecting a list of
- Index(es):
Relevant Pages
|