domains, top level, collecting a list of

domains, top level, collecting a list of

am 29.01.2008 21:37:08 von wardbayern

Is there a perl way, verses finding a published list, to collect
current top level domain names?

Thanks.

Re: domains, top level, collecting a list of

am 29.01.2008 22:14:46 von David Filmer

wardbayern@yahoo.com wrote:
> Is there a perl way, verses finding a published list, to collect
> current top level domain names?

http://search.cpan.org/~alexp/Net-Domain-TLD-1.67/lib/Net/Do main/TLD.pm

--
David Filmer (http://DavidFilmer.com)

Re: domains, top level, collecting a list of

am 30.01.2008 00:34:55 von someone

wardbayern@yahoo.com 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