patch for a connection refusing error (issue #177) where google will refuse your connection because you're sending to many requests to it, will sleep and try again

This commit is contained in:
ekultek 2017-11-28 10:15:28 -06:00
parent 97187c07f0
commit de767965e5
3 changed files with 15 additions and 5 deletions

View file

@ -73,10 +73,10 @@ b6f5f8e43c1e480329b66e193bd91751 ./lib/header_check/__init__.py
9a2bb0d52f64e12d5a63ce83874ea74a ./lib/core/common.py
1faa2b5dfad6eb538bbfe42942d2a9da ./lib/core/errors.py
d41d8cd98f00b204e9800998ecf8427e ./lib/core/__init__.py
4a87e14ed7a070ae15b1ed7ac7ceaecc ./lib/core/settings.py
b522fe8e1060ea226bce5247bb498b97 ./lib/core/settings.py
4b507b34677b414b8338475fea2c012a ./lib/core/cache.py
9a02e5b913d210350545ac26510a63c9 ./var/search/__init__.py
8402f23a2586b6f684fb1c3c04c4386f ./var/search/selenium_search.py
1c11255dbb09c0889dd0aa739a437f95 ./var/search/selenium_search.py
63ba132381a0cc2d7629852bd5e4aa17 ./var/search/pgp_search.py
d41d8cd98f00b204e9800998ecf8427e ./var/__init__.py
d41d8cd98f00b204e9800998ecf8427e ./var/auto_issue/__init__.py

View file

@ -46,7 +46,7 @@ CLONE = "https://github.com/ekultek/zeus-scanner.git"
ISSUE_LINK = "https://github.com/ekultek/zeus-scanner/issues"
# current version <major.minor.commit.patch ID>
VERSION = "1.3".format(PATCH_ID)
VERSION = "1.3.1.{}".format(PATCH_ID)
# colors to output depending on the version
VERSION_TYPE_COLORS = {"dev": 33, "stable": 92, "other": 30}

View file

@ -15,6 +15,7 @@ except ImportError:
import requests
from bs4 import BeautifulSoup
from pyvirtualdisplay import Display
from requests.exceptions import ConnectionError
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.remote.errorhandler import (
UnexpectedAlertPresentException,
@ -364,7 +365,16 @@ def parse_search_results(query, url_to_search, verbose=False, **kwargs):
))
logger.info(set_color(proxy_string_info))
req = requests.get(query_url, proxies=proxy_string, params=headers)
try:
req = requests.get(query_url, proxies=proxy_string, params=headers)
except ConnectionError:
logger.warning(set_color(
"target machine refused connection, delaying and trying again..."
))
time.sleep(3)
req = requests.get(query_url, proxies=proxy_string, params=headers)
logger.info(set_color(user_agent_info))
req.headers.update(headers)
found_urls = URL_REGEX.findall(req.text)
@ -481,7 +491,7 @@ def search_multiple_pages(query, link_amount, verbose=False, **kwargs):
"currently on page {} of search results...".format(
page_number
)
))
))
page_request = requests.get(
search_engine.format(page_number, query, page_number), params=params,
proxies=proxy_string_to_dict(proxy)