SHA256
Fixed odd behavior.
This commit is contained in:
+10
-8
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user