Skip to content

Commit

Permalink
Add timeouts to crt.sh and yandex enumerations
Browse files Browse the repository at this point in the history
With the timeout set for the enum requests, dnsrecon may continue
running even if one of the services is temporarily down or not
reachable. crt.sh sometimes takes longer to respond, so a higher 30
second timeout was chosen here.
  • Loading branch information
usd-markus committed Jun 23, 2021
1 parent ab219fd commit e360b1f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/crtenum.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def scrape_crtsh(dom):

req = Request(url=url, headers=headers)
try:
resp = urlopen(req)
resp = urlopen(req, timeout=30)
data = resp.read()
except HTTPError as e:
print_error(f'Bad http status from crt.sh: "{e.code}"')
Expand Down
3 changes: 1 addition & 2 deletions lib/yandexenum.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA


import urllib
import re
import time
Expand All @@ -42,7 +41,7 @@ def scrape_yandex(dom):
for _ in searches:
url = "https://yandex.com/search/?text=site%3A" + dom
try:
sock = urllib.request.urlopen(url)
sock = urllib.request.urlopen(url, timeout=10)
data = sock.read().decode("utf-8")
sock.close()
except Exception as e:
Expand Down

0 comments on commit e360b1f

Please sign in to comment.