From 2074bbdb9d63c5981e3ac3afbf2d9ba226f35ccb Mon Sep 17 00:00:00 2001 From: thewhiteh4t Date: Tue, 6 Aug 2024 21:41:09 +0530 Subject: [PATCH] exception handling improved in dns module --- modules/dns.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/dns.py b/modules/dns.py index cb5d194..14b35f4 100644 --- a/modules/dns.py +++ b/modules/dns.py @@ -63,6 +63,12 @@ async def fetch_records(res, domain, record): print(f'{C}DMARC \t: {W}{entry.to_text()}') if output != 'None': result.setdefault('dmarc', []).append(f'DMARC : {entry.to_text()}') + except dns.resolver.NoAnswer as exc: + log_writer(f'[dns.dmarc] Exception = {exc}') + except dns.resolver.NoMetaqueries as exc: + log_writer(f'[dns.dmarc] Exception = {exc}') + except dns.resolver.NoNameservers as exc: + log_writer(f'[dns.dmarc] Exception = {exc}') except dns.resolver.NXDOMAIN as exc: log_writer(f'[dns.dmarc] Exception = {exc}') print(f'\n{R}[-] {C}DMARC Record Not Found!{W}')