Skip to content

Instantly share code, notes, and snippets.

@dakkar
Created November 13, 2015 19:23
Show Gist options
  • Save dakkar/bfe97f842f4c69647b58 to your computer and use it in GitHub Desktop.
Save dakkar/bfe97f842f4c69647b58 to your computer and use it in GitHub Desktop.
Fetch and list all TLDs
#!/usr/bin/env perl
use strict;
use warnings;
use 5.018;
use open ':std',':locale';
use LWP::Simple;
use URI::_punycode;
my $root_zone = get('https://www.internic.net/domain/root.zone');
my @root_records = split /\n/,$root_zone;
my $last='';
while (my $line=shift @root_records) {
my ($tld,$ttl,$af,$type,@vals)=split /\s+/,$line;
$tld=lc($tld);
next if $tld eq $last;
$last=$tld;
if ($tld =~ m{^xn--(.*)\.$}) {
eval {$tld=decode_punycode($1).'.'};
}
say $tld if $type eq 'NS';
}
aaa.
aarp.
abb.
abbott.
abogado.
ac.
academy.
accenture.
accountant.
accountants.
aco.
active.
actor.
ad.
ads.
adult.
ae.
aeg.
aero.
af.
afl.
ag.
agency.
ai.
aig.
airforce.
airtel.
al.
allfinanz.
alsace.
am.
amica.
amsterdam.
android.
ao.
apartments.
app.
apple.
aq.
aquarelle.
ar.
aramco.
archi.
army.
arpa.
arte.
as.
asia.
associates.
at.
attorney.
au.
auction.
audio.
auto.
autos.
aw.
ax.
axa.
az.
azure.
ba.
band.
bank.
bar.
barcelona.
barclaycard.
barclays.
bargains.
bauhaus.
bayern.
bb.
bbc.
bbva.
bcn.
bd.
be.
beats.
beer.
bentley.
berlin.
best.
bet.
bf.
bg.
bh.
bharti.
bi.
bible.
bid.
bike.
bing.
bingo.
bio.
biz.
bj.
black.
blackfriday.
bloomberg.
blue.
bm.
bms.
bmw.
bn.
bnl.
bnpparibas.
bo.
boats.
bom.
bond.
boo.
boots.
boutique.
br.
bradesco.
bridgestone.
broker.
brother.
brussels.
bs.
bt.
budapest.
build.
builders.
business.
buzz.
bv.
bw.
by.
bz.
bzh.
ca.
cab.
cafe.
cal.
camera.
camp.
cancerresearch.
canon.
capetown.
capital.
car.
caravan.
cards.
care.
career.
careers.
cars.
cartier.
casa.
cash.
casino.
cat.
catering.
cba.
cbn.
cc.
cd.
ceb.
center.
ceo.
cern.
cf.
cfa.
cfd.
cg.
ch.
chanel.
channel.
chat.
cheap.
chloe.
christmas.
chrome.
church.
ci.
cipriani.
cisco.
citic.
city.
cityeats.
ck.
cl.
claims.
cleaning.
click.
clinic.
clothing.
cloud.
club.
clubmed.
cm.
cn.
co.
coach.
codes.
coffee.
college.
cologne.
com.
commbank.
community.
company.
computer.
condos.
construction.
consulting.
contractors.
cooking.
cool.
coop.
corsica.
country.
coupons.
courses.
cr.
credit.
creditcard.
creditunion.
cricket.
crown.
crs.
cruises.
csc.
cu.
cuisinella.
cv.
cw.
cx.
cy.
cymru.
cyou.
cz.
dabur.
dad.
dance.
date.
dating.
datsun.
day.
dclk.
de.
deals.
degree.
delivery.
dell.
delta.
democrat.
dental.
dentist.
desi.
design.
dev.
diamonds.
diet.
digital.
direct.
directory.
discount.
dj.
dk.
dm.
dnp.
do.
docs.
dog.
doha.
domains.
doosan.
download.
drive.
durban.
dvag.
dz.
earth.
eat.
ec.
edu.
education.
ee.
eg.
email.
emerck.
energy.
engineer.
engineering.
enterprises.
epson.
equipment.
er.
erni.
es.
esq.
estate.
et.
eu.
eurovision.
eus.
events.
everbank.
exchange.
expert.
exposed.
express.
fage.
fail.
faith.
family.
fan.
fans.
farm.
fashion.
feedback.
ferrero.
fi.
film.
final.
finance.
financial.
firmdale.
fish.
fishing.
fit.
fitness.
fj.
fk.
flights.
florist.
flowers.
flsmidth.
fly.
fm.
fo.
foo.
football.
forex.
forsale.
forum.
foundation.
fr.
frl.
frogans.
fund.
furniture.
futbol.
fyi.
ga.
gal.
gallery.
game.
garden.
gb.
gbiz.
gd.
gdn.
ge.
gea.
gent.
genting.
gf.
gg.
ggee.
gh.
gi.
gift.
gifts.
gives.
giving.
gl.
glass.
gle.
global.
globo.
gm.
gmail.
gmo.
gmx.
gn.
gold.
goldpoint.
golf.
goo.
goog.
google.
gop.
gov.
gp.
gq.
gr.
graphics.
gratis.
green.
gripe.
group.
gs.
gt.
gu.
gucci.
guge.
guide.
guitars.
guru.
gw.
gy.
hamburg.
hangout.
haus.
healthcare.
help.
here.
hermes.
hiphop.
hitachi.
hiv.
hk.
hm.
hn.
hockey.
holdings.
holiday.
homedepot.
homes.
honda.
horse.
host.
hosting.
hoteles.
hotmail.
house.
how.
hr.
hsbc.
ht.
hu.
hyundai.
ibm.
icbc.
ice.
icu.
id.
ie.
ifm.
iinet.
il.
im.
immo.
immobilien.
in.
industries.
infiniti.
info.
ing.
ink.
institute.
insure.
int.
international.
investments.
io.
ipiranga.
iq.
ir.
irish.
is.
ist.
istanbul.
it.
itau.
iwc.
jaguar.
java.
jcb.
je.
jetzt.
jewelry.
jlc.
jll.
jm.
jo.
jobs.
joburg.
jp.
jprs.
juegos.
kaufen.
kddi.
ke.
kg.
kh.
ki.
kia.
kim.
kinder.
kitchen.
kiwi.
km.
kn.
koeln.
komatsu.
kp.
kr.
krd.
kred.
kw.
ky.
kyoto.
kz.
la.
lacaixa.
lancaster.
land.
landrover.
lasalle.
lat.
latrobe.
law.
lawyer.
lb.
lc.
lds.
lease.
leclerc.
legal.
lexus.
lgbt.
li.
liaison.
lidl.
life.
lifestyle.
lighting.
limited.
limo.
linde.
link.
live.
lixil.
lk.
loan.
loans.
lol.
london.
lotte.
lotto.
love.
lr.
ls.
lt.
ltd.
ltda.
lu.
lupin.
luxe.
luxury.
lv.
ly.
ma.
madrid.
maif.
maison.
man.
management.
mango.
market.
marketing.
markets.
marriott.
mba.
mc.
md.
me.
media.
meet.
melbourne.
meme.
memorial.
men.
menu.
meo.
mg.
mh.
miami.
microsoft.
mil.
mini.
mk.
ml.
mm.
mma.
mn.
mo.
mobi.
moda.
moe.
moi.
mom.
monash.
money.
montblanc.
mormon.
mortgage.
moscow.
motorcycles.
mov.
movie.
movistar.
mp.
mq.
mr.
ms.
mt.
mtn.
mtpc.
mtr.
mu.
museum.
mutuelle.
mv.
mw.
mx.
my.
mz.
na.
nadex.
nagoya.
name.
navy.
nc.
ne.
nec.
net.
netbank.
network.
neustar.
new.
news.
nexus.
nf.
ng.
ngo.
nhk.
ni.
nico.
ninja.
nissan.
nl.
no.
nokia.
np.
nr.
nra.
nrw.
ntt.
nu.
nyc.
nz.
obi.
office.
okinawa.
om.
omega.
one.
ong.
onl.
online.
ooo.
oracle.
orange.
org.
organic.
osaka.
otsuka.
ovh.
pa.
page.
panerai.
paris.
partners.
parts.
party.
pe.
pet.
pf.
pg.
ph.
pharmacy.
philips.
photo.
photography.
photos.
physio.
piaget.
pics.
pictet.
pictures.
ping.
pink.
pizza.
pk.
pl.
place.
play.
playstation.
plumbing.
plus.
pm.
pn.
pohl.
poker.
porn.
post.
pr.
praxi.
press.
pro.
prod.
productions.
prof.
properties.
property.
protection.
ps.
pt.
pub.
pw.
py.
qa.
qpon.
quebec.
racing.
re.
realtor.
realty.
recipes.
red.
redstone.
rehab.
reise.
reisen.
reit.
ren.
rent.
rentals.
repair.
report.
republican.
rest.
restaurant.
review.
reviews.
rich.
ricoh.
rio.
rip.
ro.
rocher.
rocks.
rodeo.
rs.
rsvp.
ru.
ruhr.
run.
rw.
rwe.
ryukyu.
sa.
saarland.
sakura.
sale.
samsung.
sandvik.
sandvikcoromant.
sanofi.
sap.
sapo.
sarl.
saxo.
sb.
sbs.
sc.
sca.
scb.
schmidt.
scholarships.
school.
schule.
schwarz.
science.
scor.
scot.
sd.
se.
seat.
security.
seek.
sener.
services.
seven.
sew.
sex.
sexy.
sg.
sh.
shiksha.
shoes.
show.
shriram.
si.
singles.
site.
sj.
sk.
ski.
sky.
skype.
sl.
sm.
sn.
sncf.
so.
soccer.
social.
software.
sohu.
solar.
solutions.
sony.
soy.
space.
spiegel.
spreadbetting.
sr.
srl.
st.
stada.
starhub.
statoil.
stc.
stcgroup.
stockholm.
studio.
study.
style.
su.
sucks.
supplies.
supply.
support.
surf.
surgery.
suzuki.
sv.
swatch.
swiss.
sx.
sy.
sydney.
systems.
sz.
taipei.
tatamotors.
tatar.
tattoo.
tax.
taxi.
tc.
td.
team.
tech.
technology.
tel.
telefonica.
temasek.
tennis.
tf.
tg.
th.
thd.
theater.
theatre.
tickets.
tienda.
tips.
tires.
tirol.
tj.
tk.
tl.
tm.
tn.
to.
today.
tokyo.
tools.
top.
toray.
toshiba.
tours.
town.
toyota.
toys.
tr.
trade.
trading.
training.
travel.
trust.
tt.
tui.
tv.
tw.
tz.
ua.
ubs.
ug.
uk.
university.
uno.
uol.
us.
uy.
uz.
va.
vacations.
vana.
vc.
ve.
vegas.
ventures.
versicherung.
vet.
vg.
vi.
viajes.
video.
villas.
vin.
virgin.
vision.
vista.
vistaprint.
viva.
vlaanderen.
vn.
vodka.
vote.
voting.
voto.
voyage.
vu.
wales.
walter.
wang.
watch.
webcam.
website.
wed.
wedding.
weir.
wf.
whoswho.
wien.
wiki.
williamhill.
win.
windows.
wine.
wme.
work.
works.
world.
ws.
wtc.
wtf.
xbox.
xerox.
xin.
कॉम.
佛山.
慈善.
集团.
在线.
한국.
点看.
คอม.
ভারত.
八卦.
موقع.
公益.
公司.
移动.
我爱你.
москва.
қаз.
онлайн.
сайт.
срб.
бел.
קום.
时尚.
淡马锡.
орг.
नेट.
삼성.
சிங்கப்பூர்.
商标.
商店.
商城.
дети.
мкд.
新闻.
工行.
كوم.
中文网.
中信.
中国.
中國.
娱乐.
谷歌.
భారత్.
ලංකා.
ભારત.
भारत.
网店.
संगठन.
餐厅.
网络.
ком.
укр.
香港.
飞利浦.
台湾.
台灣.
手机.
мон.
الجزائر.
عمان.
ارامكو.
ایران.
امارات.
بازار.
الاردن.
بھارت.
المغرب.
السعودية.
سودان.
عراق.
مليسيا.
닷컴.
政府.
شبكة.
გე.
机构.
组织机构.
健康.
ไทย.
سورية.
рус.
рф.
تونس.
大拿.
みんな.
グーグル.
ελ.
世界.
ਭਾਰਤ.
网址.
닷넷.
コム.
游戏.
vermögensberater.
vermögensberatung.
企业.
信息.
مصر.
قطر.
广东.
இலங்கை.
இந்தியா.
հայ.
新加坡.
فلسطين.
政务.
xperia.
xxx.
xyz.
yachts.
yamaxun.
yandex.
ye.
yodobashi.
yoga.
yokohama.
youtube.
yt.
za.
zara.
zip.
zm.
zone.
zuerich.
zw.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment