domains, top level, collecting a list of

W

wardbayern

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

Thanks.
 
J

John W. Krahn

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top