Add dns_utils.get_ns()
This commit is contained in:
parent
75ba1669e0
commit
1926408a13
|
@ -12,6 +12,14 @@ def _get_dns_resolver():
|
|||
return my_resolver
|
||||
|
||||
|
||||
def get_ns(hostname) -> [str]:
|
||||
try:
|
||||
answers = _get_dns_resolver().resolve(hostname, "NS")
|
||||
except:
|
||||
return []
|
||||
return [a.to_text() for a in answers]
|
||||
|
||||
|
||||
def get_cname_record(hostname) -> Optional[str]:
|
||||
"""Return the CNAME record if exists for a domain, WITHOUT the trailing period at the end"""
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue