Skip to content

Commit

Permalink
Merge pull request #91 from dhs-ncats/bugfix/domains_are_listed_as_li…
Browse files Browse the repository at this point in the history
…ve_even_when_dns_times_out

Some domains are listed as live even when DNS times out
  • Loading branch information
jsf9k committed Oct 22, 2018
2 parents b583fd2 + 24f1e18 commit 0bedde8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion trustymail/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import unicode_literals, absolute_import, print_function

__version__ = '0.6.0'
__version__ = '0.6.1'

PublicSuffixListFilename = 'public_suffix_list.dat'
PublicSuffixListReadOnly = False
7 changes: 3 additions & 4 deletions trustymail/trustymail.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,13 @@ def mx_scan(resolver, domain):
# records more than whether their records fit in a single UDP packet.
for record in resolver.query(domain.domain_name, 'MX', tcp=True):
domain.add_mx_record(record)
except (dns.resolver.NoNameservers, dns.resolver.NXDOMAIN) as error:
except (dns.resolver.NoNameservers, dns.resolver.NXDOMAIN,
dns.resolver.NoAnswer, dns.exception.Timeout) as error:
# The NoNameServers exception means that we got a SERVFAIL response.
# These responses are almost always permanent, not temporary, so let's
# treat the domain as not live.
# treat the domain as not live if we get one of those.
domain.is_live = False
handle_error('[MX]', domain, error)
except (dns.resolver.NoAnswer, dns.exception.Timeout) as error:
handle_error('[MX]', domain, error)


def starttls_scan(domain, smtp_timeout, smtp_localhost, smtp_ports, smtp_cache):
Expand Down

0 comments on commit 0bedde8

Please sign in to comment.