Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move the NXDomain catch to look at the results now that we dont raise… #3997

Merged
merged 4 commits into from
Jan 10, 2025
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions boefjes/boefjes/plugins/kat_dns/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ def get_parent_zone_soa(resolver: dns.resolver.Resolver, name: Name) -> Answer:
def get_email_security_records(resolver: dns.resolver.Resolver, hostname: str, record_subdomain: str) -> str:
try:
answer = resolver.resolve(f"{record_subdomain}.{hostname}", "TXT", raise_on_no_answer=False)
if answer.rrset is None:
return "NXDOMAIN"
return answer.response.to_text()
except dns.resolver.NoNameservers as error:
# no servers responded happily, we'll check the response from the first
Expand All @@ -96,7 +98,5 @@ def get_email_security_records(resolver: dns.resolver.Resolver, hostname: str, r
if edeerror in (1, 2, 5, 6, 7, 8, 9, 10, 11, 12): # DNSSEC error codes defined in RFC 8914
return "DNSSECFAIL" # returned when the resolver indicates a DNSSEC failure.
raise # Not dnssec related, unhandled, raise.
except dns.resolver.NXDOMAIN:
return "NXDOMAIN"
except dns.resolver.Timeout:
return "Timeout"
Loading