mirror of
https://github.com/cwinfo/hyperboria-nodedb
synced 2024-11-10 03:50:26 +00:00
Merge pull request #89 from neilalexander/patch-1
Contrib script that generates a BIND c.f.ip6.arpa zone
This commit is contained in:
commit
3baf91a9df
30
bind-generate-ptr.py
Normal file
30
bind-generate-ptr.py
Normal file
@ -0,0 +1,30 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import sys
|
||||
# https://raw.githubusercontent.com/google/ipaddr-py/master/ipaddr.py
|
||||
import ipaddr
|
||||
import time
|
||||
|
||||
# Point this to the "nodes" file from nodedb
|
||||
|
||||
with open("nodes") as fd:
|
||||
content = fd.readlines()
|
||||
|
||||
print "$TTL 3600"
|
||||
print "$ORIGIN c.f.ip6.arpa."
|
||||
print ""
|
||||
|
||||
print "@\tIN SOA\th.ns.net. hostmaster.h.ns.net. (\n" + \
|
||||
"\t\t" + str(int(time.time())) + " ; serial\n" + \
|
||||
"\t\t1h ; slave refresh interval\n" + \
|
||||
"\t\t15m ; slave retry interval\n" + \
|
||||
"\t\t1w ; slave copy expire time\n" + \
|
||||
"\t\t1h ; NXDOMAIN cache time\n" + \
|
||||
"\t)"
|
||||
print "\tIN NS\th.ns.net"
|
||||
print "h.ns.net\tIN AAAA\t::1"
|
||||
for line in content:
|
||||
tokens = line.strip().split(" ")
|
||||
if not tokens[0] == '' and not tokens[1] == '':
|
||||
ip = ipaddr.IPv6Network(tokens[0]).exploded.split("/")[0]
|
||||
print ".".join(ip[2:][::-1].replace(":", "")) + "\tIN\tPTR\t" + tokens[1].split("/")[0] + "."
|
Loading…
Reference in New Issue
Block a user