-
-
Save jpmens/3aac1fcedb788f43deb8ed36ccf75443 to your computer and use it in GitHub Desktop.
Generate catalog zone PTR records
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/python3.7 | |
# Jan-Piet Mens, 2020-OCT-21 | |
import dns.name # pip install dnspython | |
import hashlib | |
import sys | |
if __name__ == '__main__': | |
if len(sys.argv) < 2: | |
print("Usage: {0} domain-name [domain-name ..]".format(sys.argv[0]), file=sys.stderr) | |
exit(2) | |
for domain in sys.argv[1:]: | |
fqdn = dns.name.from_text(domain) | |
h = hashlib.sha1(dns.name.from_text(domain).to_wire()).hexdigest() | |
print("{0}.zones\t\tPTR {1}".format(h, fqdn)) |
Author
jpmens
commented
Oct 21, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment