minor patch to catch the geckodriver error, happens when firefox is not compatible (issue #94)

This commit is contained in:
ekultek 2017-10-13 13:15:46 -05:00
parent bef138e4a8
commit 24cdc14e9e
4 changed files with 23 additions and 6 deletions

View file

@ -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..."

View file

@ -22,7 +22,7 @@ except NameError:
# clone link
CLONE = "https://github.com/ekultek/zeus-scanner.git"
# current version <major.minor.commit.patch ID>
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

View file

@ -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),

View file

@ -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..."