comparison make-tld-conf.py @ 300:3a3b0cbcaf6e

update tld.conf for new zones
author Carl Byington <carl@five-ten-sg.com>
date Mon, 13 Oct 2014 13:55:21 -0700
parents 9f0d9fcb58dd
children c8144da09419
comparison
equal deleted inserted replaced
299:c5624b26a29d 300:3a3b0cbcaf6e
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 import os, sys, time 3 import os, sys, time
4 4
5 def cmd(c): 5 def cmd(c):
6 print c
6 return os.popen(c).read().rstrip('\n') 7 return os.popen(c).read().rstrip('\n')
7 8
8 url = 'https://publicsuffix.org/list/effective_tld_names.dat' 9 url = 'https://publicsuffix.org/list/effective_tld_names.dat'
9 c = 'curl %s 2>/dev/null' % url 10 c = 'curl %s 2>/dev/null' % url
10 content = cmd(c) 11 content = cmd(c)
27 y = '.'.join(yy) 28 y = '.'.join(yy)
28 if not (y == x): 29 if not (y == x):
29 f.write('// %s%s\n' % (prefix, x)) 30 f.write('// %s%s\n' % (prefix, x))
30 x = y 31 x = y
31 if not prefix and (len(x.split('.')) == 1): 32 if not prefix and (len(x.split('.')) == 1):
32 rc = cmd("dig %s ns +short" % x) 33 rc = cmd("dig %s ns +short 2>&1" % x)
33 if not rc: 34 if not rc:
34 rc = cmd("sleep 3; dig %s ns +short" % x) 35 rc = cmd("sleep 3; dig %s ns +short 2>&1" % x)
35 if not rc: prefix = '// no ns record for ' 36 if not rc: prefix = '// no ns record for '
36 f.write('%s%s\n' % (prefix, x)) 37 f.write('%s%s\n' % (prefix, x))
37 f.close() 38 f.close()