@dstergiou asked:
One way to check is to visit registrars that cover TLDs and ccTLDs (like EuroDNS or Gandi) and submit your query to their forms. However since (at least TTBOMK) none of them offers any query API to check programmatically, one can script his way to an almost complete solution. ICANN provides a list of all available TLDs and we can iterate over it:
#!/usr/bin/perl
## To grab the TLDs: wget -c http://data.iana.org/TLD/tlds-alpha-by-domain.txt
use Net::DNS;
$check = shift or die;
open F, "< tlds-alpha-by-domain.txt" or die;
while (<F>) {
next if (m/^#/);
chop;
push @tlds, $_;
}
close F;
foreach $i (@tlds) {
my $domain = $check . "." . $i . ".";
my $res = Net::DNS::Resolver->new;
my $query = $res->query($domain, "NS");
if ($query) {
## foreach $rr (grep { $_->type eq 'NS' } $query->answer) { print $rr->nsdname, "\n"; }
print $domain, "\n";
}
}
The above hack comes with three problems:
- It uses Net::DNS which makes it a little slow. There is room for improvement.
- It finds out about registered domain names that have domain name servers that answer queries about them. This is not always the case. For example in .GR one can register a domain without having it served.
- It also does not take into account strict domain hierarchies, like .co.uk, .net.uk, .org.uk but minimal changes are needed to test that too.
Somewhat incomplete as a solution, but adequate as a 5 minute hack for most purposes.
P.S. @stsimb offers a similar solution using dig:
Δεν είναι script, αλλά τη δουλειά του την κάνει και έχει μια τεράστια λίστα με tlds.
http://www.eurodns.com/tlds/getSearchForm/advanced/frontPage
Ευχαριστώ για το link. Εγώ χρησιμοποιώ αντίστοιχα το http://www.gandi.net.