add support for /16,/8 + show critical error if 'dnspython' isn't installed
This commit is contained in:
parent
e60a2b1927
commit
86c7a00b5b
1 changed files with 19 additions and 9 deletions
|
@ -8,12 +8,18 @@ import os
|
|||
import subprocess
|
||||
import json
|
||||
|
||||
try:
|
||||
import dns.name
|
||||
import dns.query
|
||||
import dns.dnssec
|
||||
import dns.message
|
||||
import dns.resolver
|
||||
import dns.rdatatype
|
||||
except ImportError:
|
||||
print()
|
||||
print("CRITICAL: this script requires the 'dnspython' libary, please install it using `python3 -m pip install dnspython`")
|
||||
print()
|
||||
exit(1)
|
||||
|
||||
# import errors so they could be try/catched
|
||||
import dns.exception
|
||||
|
@ -80,10 +86,14 @@ def get_domain_by_mntner(mntner):
|
|||
_domain_name = ".".join(
|
||||
line.split(".")[::-1]) + ".in-addr.arpa"
|
||||
if int(line.split("/")[1]) == 24:
|
||||
_domain_name.replace("/24", "")
|
||||
_domain_name = _domain_name.replace("0/24.", "")
|
||||
elif int(line.split("/")[1]) == 16:
|
||||
_domain_name = _domain_name.replace("0/16.0.", "")
|
||||
elif int(line.split("/")[1]) == 8:
|
||||
_domain_name = _domain_name.replace("0/8.0.0.", "")
|
||||
elif int(line.split("/")[1]) <=24:
|
||||
# TODO: implement creation of multiple zones for every /24 within
|
||||
pass
|
||||
print(f"WARN: currently only ipv4 subnets with length >=24 or 16 or 8 are possible to be checked: relavent inetnum {line}")
|
||||
elif line.startswith("nserver"):
|
||||
nserver = line[20:].split(" ")
|
||||
# handle edge case where
|
||||
|
|
Loading…
Add table
Reference in a new issue