From 24cdc14e9e9a09cd1459f435dce6ba915c8e14fa Mon Sep 17 00:00:00 2001 From: ekultek Date: Fri, 13 Oct 2017 13:15:46 -0500 Subject: [PATCH] minor patch to catch the geckodriver error, happens when firefox is not compatible (issue #94) --- lib/attacks/sqlmap_scan/__init__.py | 13 ++++++++++--- lib/core/settings.py | 2 +- var/auto_issue/github.py | 8 ++++++-- zeus.py | 6 ++++++ 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/lib/attacks/sqlmap_scan/__init__.py b/lib/attacks/sqlmap_scan/__init__.py index d956578..ea4e415 100644 --- a/lib/attacks/sqlmap_scan/__init__.py +++ b/lib/attacks/sqlmap_scan/__init__.py @@ -1,7 +1,7 @@ import json -import os import time import re +import subprocess try: import urllib2 # python 2 @@ -128,6 +128,8 @@ def sqlmap_scan_main(url, port=None, verbose=None, opts=None, auto_start=False): """ return {key: value for key, value in opts} + is_started = lib.core.settings.search_for_process("sqlmapapi.py") + if auto_start: lib.core.settings.logger.info(lib.core.settings.set_color( "attempting to find sqlmap on your system..." @@ -137,12 +139,18 @@ def sqlmap_scan_main(url, port=None, verbose=None, opts=None, auto_start=False): lib.core.settings.logger.info(lib.core.settings.set_color( "attempting to call sqlmap API..." )) - os.spawnl(os.P_NOWAIT, "python {} -s".format(os.path.join(path, "sqlmapapi.py"))) + subprocess.Popen(["python {}/{} -s".format(path, "sqlmapapi.py")], shell=True, + close_fds=True, stdout=subprocess.PIPE) lib.core.settings.logger.info(lib.core.settings.set_color( "API started, continuing process..." ) ) time.sleep(3) + if not is_started: + lib.core.settings.prompt( + "appears that sqlmap's API was not started successfully, start it manually and press" + " enter..." + ) except Exception as e: print e lib.core.settings.logger.error(lib.core.settings.set_color( @@ -152,7 +160,6 @@ def sqlmap_scan_main(url, port=None, verbose=None, opts=None, auto_start=False): "press enter when ready to start..." ) else: - is_started = lib.core.settings.search_for_process("sqlmapapi.py") if not is_started: lib.core.settings.prompt( "sqlmap API is not started, start it and press enter to continue..." diff --git a/lib/core/settings.py b/lib/core/settings.py index edbef51..97df5bb 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -22,7 +22,7 @@ except NameError: # clone link CLONE = "https://github.com/ekultek/zeus-scanner.git" # current version -VERSION = "1.0.44.f2a0" +VERSION = "1.0.45.3bd2" # colors to output depending on the version VERSION_TYPE_COLORS = {"dev": 33, "stable": 92, "other": 30} # version string formatting diff --git a/var/auto_issue/github.py b/var/auto_issue/github.py index 48a7ff5..b7f7243 100644 --- a/var/auto_issue/github.py +++ b/var/auto_issue/github.py @@ -24,11 +24,14 @@ from lib.core.settings import ( def get_browser_version(): + logger.info(set_color( + "attempting to get firefox browser version..." + )) try: output = subprocess.check_output(['firefox', '--version']) except Exception: logger.error(set_color( - "failed to run forefox...", level=50 + "failed to run firefox...", level=50 )) return "failed to start" try: @@ -102,6 +105,7 @@ def request_issue_creation(): current_log_file = get_latest_log_file(CURRENT_LOG_FILE_PATH) stacktrace = __extract_stacktrace(current_log_file) issue_title = stacktrace.split("\n")[-2] + ff_version = get_browser_version() issue_data = { "title": issue_title, @@ -112,7 +116,7 @@ def request_issue_creation(): "Commands used:\n`{}`\n\n" "Log file info:\n```{}```".format( VERSION, - get_browser_version(), + "", str(stacktrace), str(platform.platform()), " ".join(sys.argv), diff --git a/zeus.py b/zeus.py index 36163dd..380d7e1 100755 --- a/zeus.py +++ b/zeus.py @@ -664,6 +664,12 @@ if __name__ == "__main__": "all open sessions of firefox killed, it should be safe to re-run " "Zeus..." )) + elif "Service geckodriver unexpectedly exited" in str(e): + logger.fatal(set_color( + "it seems that your firefox version is not compatible with the geckodriver " + "version. please update firefox and try again...", level=50 + )) + shutdown() else: logger.info(set_color( "kill off the open sessions of firefox and re-run Zeus..."