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 = []
|
results = []
|
||||||
response_rcode = r.rcode()
|
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
|
# Check answer section first
|
||||||
answers = r.answer
|
answers = r.answer
|
||||||
if answers:
|
if answers:
|
||||||
for rrset in answers:
|
for rrset in answers:
|
||||||
for item in rrset:
|
for item in rrset:
|
||||||
results.append(str(item))
|
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)
|
# If no answer, check additional section (some servers put records there)
|
||||||
additional = r.additional
|
additional = r.additional
|
||||||
@@ -160,12 +167,7 @@ def perform_query(full_domain, ns, record_type, timeout):
|
|||||||
if results:
|
if results:
|
||||||
return (full_domain, ns, results)
|
return (full_domain, ns, results)
|
||||||
|
|
||||||
# Truly no records found - check if there's a non-NOERROR response code to report
|
# Truly no records found
|
||||||
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
|
|
||||||
return (full_domain, ns, "NO RECORDS")
|
return (full_domain, ns, "NO RECORDS")
|
||||||
except (exception.Timeout, TimeoutError):
|
except (exception.Timeout, TimeoutError):
|
||||||
return (full_domain, ns, "TIMED OUT")
|
return (full_domain, ns, "TIMED OUT")
|
||||||
|
|||||||
Reference in New Issue
Block a user