Fixed odd behavior.

This commit is contained in:
Discsearcher
2026-08-12 09:31:22 -04:00
parent 7929efabbf
commit c65f574c1d
+10 -8
View File
@@ -133,14 +133,21 @@ def perform_query(full_domain, ns, record_type, timeout):
results = []
response_rcode = r.rcode()
# Check response code
response_rcode = r.rcode()
if response_rcode != 0: # 0 = NOERROR
rcode_name = rcode.to_text(response_rcode)
return (full_domain, ns, f"RCODE: {rcode_name}")
results = []
# Check answer section first
answers = r.answer
if answers:
for rrset in answers:
for item in rrset:
results.append(str(item))
if results:
return (full_domain, ns, results)
return (full_domain, ns, results)
# If no answer, check additional section (some servers put records there)
additional = r.additional
@@ -160,12 +167,7 @@ def perform_query(full_domain, ns, record_type, timeout):
if results:
return (full_domain, ns, results)
# Truly no records found - check if there's a non-NOERROR response code to report
if response_rcode != 0: # 0 = NOERROR
rcode_name = rcode.to_text(response_rcode)
return (full_domain, ns, f"RCODE: {rcode_name}")
# No records and NOERROR response
# Truly no records found
return (full_domain, ns, "NO RECORDS")
except (exception.Timeout, TimeoutError):
return (full_domain, ns, "TIMED OUT")