diff --git a/app/dns_utils.py b/app/dns_utils.py index 896d1b85..6795c6bc 100644 --- a/app/dns_utils.py +++ b/app/dns_utils.py @@ -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: diff --git a/shell.py b/shell.py index 4cbb5b64..f50b0a48 100644 --- a/shell.py +++ b/shell.py @@ -9,6 +9,7 @@ from app.config import ( ALIAS_DOMAINS, PREMIUM_ALIAS_DOMAINS, ) +from app.dns_utils import get_ns from app.email_utils import send_email, render, get_email_domain_part from app.models import * from job_runner import (