-
Notifications
You must be signed in to change notification settings - Fork 2
/
dns-nodenames.py
executable file
·46 lines (36 loc) · 1.01 KB
/
dns-nodenames.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env python3
import time
import re
import subprocess
import json
nodes = {}
output = subprocess.check_output(["alfred-json","-r","158","-f","json","-z"])
data = json.loads(output.decode("utf-8"))
for mac, node in data.items():
try:
hostname = re.sub(r'[^a-z0-9\-]',"", node["hostname"].lower())
for address in node["network"]["addresses"]:
if address.startswith("fd00"):
nodes[hostname] = address
except:
pass
print("$ORIGIN nodes.fffd.eu.")
print("$TTL 3600 ; 1 Stunde")
print("@ IN SOA ns.fffd.eu. hostmaster.fffd.eu. (")
print(" " + str(int(time.time())) + "; serial")
print(" 86400 ; refresh")
print(" 7200 ; retry")
print(" 3600000 ; expire")
print(" 7200 ; TTL")
print(" )")
print("")
print("")
print("@ IN NS ns1.fffd.eu.")
print("@ IN NS ns3.fffd.eu.")
print("@ IN NS ns4.fffd.eu.")
print("")
print("")
for hostname in nodes.keys():
print(hostname + " IN AAAA " + nodes[hostname])
print("")
print("")