From b86db8008fdfffbcc14277b1ffe9f6c5075f352b Mon Sep 17 00:00:00 2001 From: ekultek Date: Wed, 6 Dec 2017 10:48:58 -0600 Subject: [PATCH] update for an issue #233, #234, #235 and #237. issue was with Tor (proxy 127.0.0.1:9050) needed a higher timeout for it --- etc/checksum/md5sum.md5 | 8 ++++---- lib/attacks/nmap_scan/__init__.py | 5 +++-- lib/core/common.py | 11 +++++++++-- lib/core/settings.py | 4 ++-- lib/header_check/__init__.py | 2 +- 5 files changed, 19 insertions(+), 11 deletions(-) diff --git a/etc/checksum/md5sum.md5 b/etc/checksum/md5sum.md5 index 1b1041c..3840f28 100644 --- a/etc/checksum/md5sum.md5 +++ b/etc/checksum/md5sum.md5 @@ -93,14 +93,14 @@ d41d8cd98f00b204e9800998ecf8427e ./lib/attacks/__init__.py 8ec72bb33df998e32b925e3060d9d17a ./lib/attacks/whois_lookup/whois.py 916b768e783ff771bce80bd6f5112d4f ./lib/attacks/admin_panel_finder/__init__.py 52942c7b33ff696901f5a4201ba4507f ./lib/attacks/xss_scan/__init__.py -7642d078fe304a7ca8bfaaa070a0cb31 ./lib/attacks/nmap_scan/__init__.py +6b8ad5d11aa7f1e2b5f993ca3dde1975 ./lib/attacks/nmap_scan/__init__.py 216999fa0e84866d5c1d96d5676034e4 ./lib/attacks/nmap_scan/nmap_opts.py -c01ef6dc27a2d3ff99e282ccc89d7d45 ./lib/header_check/__init__.py -cd8e35cfd995d0a93892cfc83f01dea7 ./lib/core/common.py +8ef704ee0460fdec5ea03f47036664fe ./lib/header_check/__init__.py +d2f8777360a73a412ef158eff2fdf631 ./lib/core/common.py 4433353fb5c55578391d8b4006191ee8 ./lib/core/errors.py 38d8ce4aec42ec147b44a36c69b15ea8 ./lib/core/parse.py d41d8cd98f00b204e9800998ecf8427e ./lib/core/__init__.py -0112338e057d62d4580c86033c18df05 ./lib/core/settings.py +f3b7a9cae1668e883541b388107f07c4 ./lib/core/settings.py de4254c5e40f7aa4fb81e0608f758a2c ./lib/core/decorators.py 9a02e5b913d210350545ac26510a63c9 ./var/search/__init__.py 83928f6c090722d87a905a447cb51aed ./var/search/selenium_search.py diff --git a/lib/attacks/nmap_scan/__init__.py b/lib/attacks/nmap_scan/__init__.py index cab39b4..02638a4 100644 --- a/lib/attacks/nmap_scan/__init__.py +++ b/lib/attacks/nmap_scan/__init__.py @@ -41,7 +41,7 @@ class NmapHook(object): """ send all the information to a JSON file for further use """ - lib.core.common.write_to_log_file( + return lib.core.common.write_to_log_file( data, lib.core.settings.NMAP_LOG_FILE_PATH, lib.core.settings.NMAP_FILENAME.format(self.ip) ) @@ -55,10 +55,11 @@ class NmapHook(object): lib.core.settings.logger.info(lib.core.settings.set_color("finding data for IP '{}'...".format(self.ip))) json_data = json.loads(json_data)["scan"] host = json_data[self.ip]["hostnames"][0]["name"] + host_skip = (not len(host) == 0, " ", "", None) print( "{}\nScanned: {} ({})\tStatus: {}\nProtocol: {}\n".format( sep, self.ip, - host if host is not "" or None or not len(host) == 0 else "unknown", + host if host != any(s for s in list(host_skip)) else "unknown", json_data[self.ip]["status"]["state"], "TCP" ) diff --git a/lib/core/common.py b/lib/core/common.py index 9a7ef50..2337f82 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -24,7 +24,7 @@ STATUS_CODES = { 200: "OK", 201: "created", 202: "accepted", 203: "non-authoritative information", 204: "no content", 205: "reset content", 206: "partial content", 207: "multi-status", 208: "already reported", 226: "IM used", - 300: "multiple choices", 301: "moved permanently", 302: "not found", + 300: "multiple choices", 301: "moved permanently", 302: "found redirect", 303: "see other", 304: "not modified", 305: "use proxy", 306: "switch proxy", 308: "permanent redirect", 400: "bad request", 401: "unauthorized", 402: "payment required", @@ -329,7 +329,14 @@ def get_page(url, **kwargs): else: proxies = {} - req = requests.get(url, params=headers, proxies=proxies, verify=False if skip_verf else True, timeout=20) + if proxy is not None and "127.0.0.1" in proxy: + lib.core.settings.logger.warning(lib.core.settings.set_color( + "timeout has been set to 40s due to Tor being used..." + )) + req = requests.get(url, params=headers, proxies=proxies, verify=False, timeout=40) + else: + req = requests.get(url, params=headers, proxies=proxies, verify=False, timeout=20) + status = req.status_code html = req.content headers = req.headers diff --git a/lib/core/settings.py b/lib/core/settings.py index 9aaf2ce..a11335a 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -45,7 +45,7 @@ CLONE = "https://github.com/ekultek/zeus-scanner.git" ISSUE_LINK = "https://github.com/ekultek/zeus-scanner/issues" # current version -VERSION = "1.4".format(PATCH_ID) +VERSION = "1.4.1.{}".format(PATCH_ID) # colors to output depending on the version VERSION_TYPE_COLORS = {"dev": 33, "stable": 92, "other": 30} @@ -320,7 +320,7 @@ URL_EXCLUDES = ( "torproject.org", "search-results.com", "index.com", "gov", ".gov", "facebook.com", "instagram.com", "snapchat", "stackoverflow", "stackexchange", "github.com", "apple.com", - "http://my." + "http://my.", "root.cern" ) # regular expressions used for DBMS recognition based on error message response diff --git a/lib/header_check/__init__.py b/lib/header_check/__init__.py index 336753e..91a4bd6 100644 --- a/lib/header_check/__init__.py +++ b/lib/header_check/__init__.py @@ -46,7 +46,7 @@ def get_charset(html, headers, **kwargs): content = headers.get(HTTP_HEADER.CONTENT_TYPE, "") charset = charset_regex.search(content) if charset is not None: - return charset + return charset.group(1) return None