patch for an issue where if the site refuses connection it would keep trying to crawl it (issue #134)

This commit is contained in:
ekultek 2017-11-03 09:49:58 -05:00
parent 69fd18d5a5
commit 90ba39f3ed
4 changed files with 26 additions and 10 deletions

View file

@ -44,10 +44,10 @@ f746d2867f493104a78d0540cf50c03f ./lib/attacks/intel_me/__init__.py
c8fe372b08e7e27fe4e21f5f730f22ec ./lib/attacks/clickjacking_scan/__init__.py
1faa2b5dfad6eb538bbfe42942d2a9da ./lib/core/errors.py
d41d8cd98f00b204e9800998ecf8427e ./lib/core/__init__.py
cf2f33084ee604925738dc2b40f19aee ./lib/core/settings.py
6d80ab9bf54a4a4412719b1268334cff ./lib/core/settings.py
d41d8cd98f00b204e9800998ecf8427e ./var/google_search/__init__.py
5895fefecd3ae3b52e68a490478823bb ./var/google_search/search.py
fe2fb9df1a0c525ca69cca3bbe6e8acc ./var/google_search/search.py
d41d8cd98f00b204e9800998ecf8427e ./var/__init__.py
d41d8cd98f00b204e9800998ecf8427e ./var/auto_issue/__init__.py
4506850a02aa18e12bef4efeb760ad9e ./var/auto_issue/github.py
804cfbdaac8afd878b79fdceddaece2a ./var/blackwidow/__init__.py
059765fe1ae084ad267d4b7aa7a34032 ./var/blackwidow/__init__.py

View file

@ -41,7 +41,7 @@ PATCH_ID = str(subprocess.check_output(["git", "rev-parse", "origin/master"]))[:
# clone link
CLONE = "https://github.com/ekultek/zeus-scanner.git"
# current version <major.minor.commit.patch ID>
VERSION = "1.1.15".format(PATCH_ID)
VERSION = "1.1.16.{}".format(PATCH_ID)
# colors to output depending on the version
VERSION_TYPE_COLORS = {"dev": 33, "stable": 92, "other": 30}
# version string formatting

View file

@ -8,6 +8,7 @@ from bs4 import BeautifulSoup
import lib.core.errors
import lib.core.settings
import var.auto_issue.github
class Blackwidow(object):
@ -58,11 +59,26 @@ class Blackwidow(object):
)
)
except Exception as e:
lib.core.settings.logger.exception(lib.core.settings.set_color(
"failed to connect to '{}' received error '{}'...".format(
self.url, e
)
))
if "Max retries exceeded with url" in str(e):
info_msg = ""
if "https://" in self.url:
info_msg += ", try dropping https:// to http://"
else:
info_msg += ""
lib.core.settings.logger.fatal(lib.core.settings.set_color(
"provided website '{}' is refusing connection{}...".format(
self.url, info_msg
), level=50
))
lib.core.settings.shutdown()
else:
lib.core.settings.logger.exception(lib.core.settings.set_color(
"failed to connect to '{}' received error '{}'...".format(
self.url, e
), level=50
))
var.auto_issue.github.request_issue_creation()
lib.core.settings.shutdown()
def scrape_page_for_links(self, given_url, attribute="a", descriptor="href"):
"""

View file

@ -98,7 +98,7 @@ def set_tor_browser_settings(ff_browser, default_port="9050", **kwargs):
preferences = {
"privacy": [
# set the privacy settings
("places.history.enabled", False),\
("places.history.enabled", False),
("privacy.clearOnShutdown.offlineApps", True),
("privacy.clearOnShutdown.passwords", True),
("privacy.clearOnShutdown.siteSettings", True),