Skip to content

Commit

Permalink
Be more liberal with our exception handling when making network requests
Browse files Browse the repository at this point in the history
  • Loading branch information
mschwager committed Aug 3, 2016
1 parent 4b07a4e commit 1f69dd0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions fierce.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ def find_subdomain_list_file(filename):
return filename


def head_request(url):
conn = http.client.HTTPConnection(url)
def head_request(url, timeout=2):
conn = http.client.HTTPConnection(url, timeout=timeout)

try:
conn.request("HEAD", "/")
except socket.gaierror:
except (ConnectionError, socket.gaierror, socket.timeout):
return []
else:
resp = conn.getresponse()
Expand Down Expand Up @@ -115,7 +115,7 @@ def reverse_query(resolver, ip):
def zone_transfer(address, domain):
try:
return dns.zone.from_xfr(dns.query.xfr(address, domain))
except (ConnectionResetError, dns.exception.FormError):
except (ConnectionError, dns.exception.FormError):
return None


Expand Down

0 comments on commit 1f69dd0

Please sign in to comment.