From 54dd5d47f5309b5a2019b82ef947ab10ecd7628e Mon Sep 17 00:00:00 2001 From: ekultek Date: Sat, 2 Dec 2017 07:31:02 -0600 Subject: [PATCH] the gaierror has been taken care of once and for all, if it fails it's not going to try and find the IP address (issue #215), fixes and issue with chunked encoding errors, about 99% of the time when you try to request again it will work, so that's what we're gonna do (issue #214) --- etc/checksum/md5sum.md5 | 6 +++--- lib/attacks/nmap_scan/__init__.py | 12 ++++++------ lib/attacks/xss_scan/__init__.py | 10 +++++++++- lib/core/settings.py | 4 ++-- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/etc/checksum/md5sum.md5 b/etc/checksum/md5sum.md5 index 6c8242b..5545d53 100644 --- a/etc/checksum/md5sum.md5 +++ b/etc/checksum/md5sum.md5 @@ -70,14 +70,14 @@ d41d8cd98f00b204e9800998ecf8427e ./lib/attacks/__init__.py 7bc7a6f3e85651aab3588f087563eded ./lib/attacks/whois_lookup/__init__.py 8ec72bb33df998e32b925e3060d9d17a ./lib/attacks/whois_lookup/whois.py 67ac65be1b4394ad80ec0fd3472c5309 ./lib/attacks/admin_panel_finder/__init__.py -75652b6197e9775e58e177f5e2fc680c ./lib/attacks/xss_scan/__init__.py -75652b6197e9775e58e177f5e2fc680c ./lib/attacks/nmap_scan/__init__.py +2904026c0a34de2bd2eef63c75e3f67e ./lib/attacks/xss_scan/__init__.py +7642d078fe304a7ca8bfaaa070a0cb31 ./lib/attacks/nmap_scan/__init__.py 216999fa0e84866d5c1d96d5676034e4 ./lib/attacks/nmap_scan/nmap_opts.py 888686098a0850750f2435d0e1645944 ./lib/header_check/__init__.py 0721c655d433dbc170756f3e40a786cf ./lib/core/common.py 4433353fb5c55578391d8b4006191ee8 ./lib/core/errors.py d41d8cd98f00b204e9800998ecf8427e ./lib/core/__init__.py -5f7fd52c614f1a0f280191592d4b08b3 ./lib/core/settings.py +1e26c0e7492ca6a18a10e70369c55e99 ./lib/core/settings.py 801a4f7ac892b74676c649bd4844ccdb ./lib/core/decorators.py 9a02e5b913d210350545ac26510a63c9 ./var/search/__init__.py 0545ee54ade186681b25d157fb32f350 ./var/search/selenium_search.py diff --git a/lib/attacks/nmap_scan/__init__.py b/lib/attacks/nmap_scan/__init__.py index b1036f3..cab39b4 100644 --- a/lib/attacks/nmap_scan/__init__.py +++ b/lib/attacks/nmap_scan/__init__.py @@ -106,15 +106,15 @@ def perform_port_scan(url, scanner=NmapHook, **kwargs): lib.core.settings.logger.info(lib.core.settings.set_color( "attempting to find IP address for hostname '{}'...".format(url) )) - if "www" not in url: - url = "www.{}".format(url) + try: found_ip_address = socket.gethostbyname(url) except socket.gaierror: - found_ip_address = socket.gethostbyname_ex(url) - lib.core.settings.logger.info(lib.core.settings.set_color( - "found IP address for given URL -> '{}'...".format(found_ip_address), level=25 - )) + lib.core.settings.logger.fatal(lib.core.settings.set_color( + "failed to gather IP address for URL '{}'...".format(url) + )) + return + if verbose: lib.core.settings.logger.debug(lib.core.settings.set_color( "checking for nmap on your system...", level=10 diff --git a/lib/attacks/xss_scan/__init__.py b/lib/attacks/xss_scan/__init__.py index 73aa0ed..d15b1c6 100644 --- a/lib/attacks/xss_scan/__init__.py +++ b/lib/attacks/xss_scan/__init__.py @@ -114,7 +114,15 @@ def scan_xss(url, agent=None, proxy=None): lib.core.common.HTTP_HEADER.CONNECTION: "close", lib.core.common.HTTP_HEADER.USER_AGENT: user_agent } - xss_request = requests.get(url, proxies=config_proxy, headers=config_headers) + + try: + xss_request = requests.get(url, proxies=config_proxy, headers=config_headers) + except requests.exceptions.ChunkedEncodingError: + lib.core.settings.logger.warning(lib.core.settings.set_color( + "encoding seems to be messed up, trying the request again...", level=30 + )) + xss_request = requests.get(url, proxies=config_proxy, headers=config_headers) + status = xss_request.status_code html_data = xss_request.content query = find_xss_script(url) diff --git a/lib/core/settings.py b/lib/core/settings.py index 81f8dc1..b214646 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -46,7 +46,7 @@ CLONE = "https://github.com/ekultek/zeus-scanner.git" ISSUE_LINK = "https://github.com/ekultek/zeus-scanner/issues" # current version -VERSION = "1.3.12.{}".format(PATCH_ID) +VERSION = "1.3.13.{}".format(PATCH_ID) # colors to output depending on the version VERSION_TYPE_COLORS = {"dev": 33, "stable": 92, "other": 30} @@ -201,7 +201,7 @@ SQLI_FOUND_FILENAME = "sqli-sites.log" CLICKJACKING_FILENAME = "{}-clickjacking.html" # filename for gists log file -GIST_FILENAME = "gist-match-{}.log" +GIST_FILENAME = "{}-gist-match.log" # filename for whois lookup log file WHOIS_LOOKUP_FILENAME = "{}-whois.json"