domains, top level, collecting a list of

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

Thanks.
wardbayern [ Di, 29 Januar 2008 21:37 ] [ ID #1919487 ]

Re: domains, top level, collecting a list of

wardbayern [at] 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)
David Filmer [ Di, 29 Januar 2008 22:14 ] [ ID #1919489 ]

Re: domains, top level, collecting a list of

wardbayern [at] 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
someone [ Mi, 30 Januar 2008 00:34 ] [ ID #1919493 ]
Perl » comp.lang.perl.misc » domains, top level, collecting a list of

Vorheriges Thema: FAQ 8.40 How do I avoid zombies on a Unix system?
Nächstes Thema: FAQ 9.15 How do I parse a mail header?