From 97b620aef484c0d2066466b6a305f95c617aa42e Mon Sep 17 00:00:00 2001 From: ekultek Date: Thu, 5 Oct 2017 21:21:51 -0500 Subject: [PATCH] initial fix for issue #49, still more work to be done --- lib/attacks/admin_panel_finder/__init__.py | 2 -- lib/attacks/intel_me/__init__.py | 2 -- lib/attacks/nmap_scan/__init__.py | 2 -- lib/attacks/sqlmap_scan/__init__.py | 6 ++--- lib/settings.py | 2 +- var/auto_issue/github.py | 15 ++++++++++- zeus.py | 29 ++++------------------ 7 files changed, 23 insertions(+), 35 deletions(-) diff --git a/lib/attacks/admin_panel_finder/__init__.py b/lib/attacks/admin_panel_finder/__init__.py index a712ef9..0264850 100644 --- a/lib/attacks/admin_panel_finder/__init__.py +++ b/lib/attacks/admin_panel_finder/__init__.py @@ -12,7 +12,6 @@ from lib.settings import ( replace_http, set_color, create_tree, - fix_log_file ) @@ -60,7 +59,6 @@ def check_for_admin_page(url, exts, protocol="http://", show_possibles=False, ve logger.exception(set_color( "failed to connect with unexpected error '{}'...".format(str(e)), level=50 )) - fix_log_file() request_issue_creation() possible_connections, connections = list(possible_connections), list(connections) data_msg = "found {} possible connections(s) and {} successful connection(s)..." diff --git a/lib/attacks/intel_me/__init__.py b/lib/attacks/intel_me/__init__.py index 74b911c..0c5d811 100644 --- a/lib/attacks/intel_me/__init__.py +++ b/lib/attacks/intel_me/__init__.py @@ -9,7 +9,6 @@ from lib.settings import ( proxy_string_to_dict, logger, set_color, DEFAULT_USER_AGENT, - fix_log_file ) @@ -122,5 +121,4 @@ def main_intel_amt(url, agent=None, proxy=None): logger.exception(set_color( "ran into exception '{}', cannot continue...".format(e) )) - fix_log_file() request_issue_creation() diff --git a/lib/attacks/nmap_scan/__init__.py b/lib/attacks/nmap_scan/__init__.py index 202f671..2aa40d1 100644 --- a/lib/attacks/nmap_scan/__init__.py +++ b/lib/attacks/nmap_scan/__init__.py @@ -9,7 +9,6 @@ from lib.settings import ( set_color, create_dir, find_application, - fix_log_file ) @@ -135,7 +134,6 @@ def perform_port_scan(url, ports=None, scanner=NmapHook, verbose=False, opts=Non logger.exception(set_color( "ran into exception '{}', cannot continue quitting...".format(e), level=50 )) - fix_log_file() request_issue_creation() pass else: diff --git a/lib/attacks/sqlmap_scan/__init__.py b/lib/attacks/sqlmap_scan/__init__.py index 0b9e93d..31af594 100644 --- a/lib/attacks/sqlmap_scan/__init__.py +++ b/lib/attacks/sqlmap_scan/__init__.py @@ -40,7 +40,7 @@ class SqlmapHook(object): new_scan_url = "{}{}".format(self.connection, self.commands["init"]) return requests.get(new_scan_url, params=self.headers) - def get_scan_id(self): + def get_scan_id(self, split_by=16): """ get the ID of the current API scan """ @@ -48,7 +48,8 @@ class SqlmapHook(object): api_id_url = "{}{}".format(self.connection, self.commands["id"]) req = requests.get(api_id_url) to_check = str(json.loads(req.content)["tasks"]).lower() - return ''.join(id_re.findall(to_check)) + current_scan_id = ''.join(id_re.findall(to_check)) + return current_scan_id def start_scan(self, api_id, opts=None): """ @@ -189,6 +190,5 @@ def sqlmap_scan_main(url, port=None, verbose=None, auto_search=False, opts=None, "ran into error '{}', seems something went wrong, error has " "been saved to current log file.".format(e), level=50 )) - lib.settings.fix_log_file() request_issue_creation() pass diff --git a/lib/settings.py b/lib/settings.py index 1b4e4f1..656a256 100644 --- a/lib/settings.py +++ b/lib/settings.py @@ -22,7 +22,7 @@ except NameError: # clone link CLONE = "https://github.com/ekultek/zeus-scanner.git" # current version -VERSION = "1.0.29" +VERSION = "1.0.29.1f59" # 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 7a01035..5b68dea 100644 --- a/var/auto_issue/github.py +++ b/var/auto_issue/github.py @@ -14,7 +14,10 @@ from lib.settings import ( set_color, get_latest_log_file, CURRENT_LOG_FILE_PATH, - VERSION + VERSION, + shutdown, + prompt, + fix_log_file ) @@ -35,6 +38,16 @@ def decode(n, token): def request_issue_creation(): + question = prompt( + "would you like to create an anonymous issue and post it to Zeus's Github", opts="yN" + ) + if question.lower().startswith("n"): + logger.error(set_color( + "Zeus has experienced an internal error and cannot continue, shutting down...", level=40 + )) + shutdown() + + fix_log_file() logger.info(set_color( "Zeus got an unexpected error and will automatically create an issue for this error, please wait..." )) diff --git a/zeus.py b/zeus.py index 41fff61..53d2527 100755 --- a/zeus.py +++ b/zeus.py @@ -413,12 +413,7 @@ if __name__ == "__main__": logger.exception(set_color( "ran into exception '{}'...".format(e), level=50 )) - issue = prompt( - "would you like to create an anonymous issue on Zeus's Github page", opts="yN" - ) - if issue.lower().startswith("y"): - fix_log_file() - request_issue_creation() + request_issue_creation() pass urls_to_use = get_latest_log_file(URL_LOG_PATH) @@ -490,12 +485,7 @@ if __name__ == "__main__": logger.exception(set_color( "ran into exception '{}'...".format(e), level=50 )) - issue = prompt( - "would you like to create an anonymous issue on Zeus's Github page", opts="yN" - ) - if issue.lower().startswith("y"): - fix_log_file() - request_issue_creation() + request_issue_creation() pass urls_to_use = get_latest_log_file(URL_LOG_PATH) @@ -540,12 +530,8 @@ if __name__ == "__main__": "ran into exception '{}' and cannot continue, saved to current log file...".format(e), level=50 )) - issue = prompt( - "would you like to create an anonymous issue on Zeus's Github page", opts="yN" - ) - if issue.lower().startswith("y"): - fix_log_file() - request_issue_creation() + request_issue_creation() + pass elif opt.spiderWebSite: problem_identifiers = ["http://", "https://"] @@ -633,12 +619,7 @@ if __name__ == "__main__": logger.exception(set_color( "ran into exception '{}' exception has been saved to log file...".format(e), level=50 )) - issue = prompt( - "would you like to create an anonymous issue on Zeus's Github page", opts="yN" - ) - if issue.lower().startswith("y"): - fix_log_file() - request_issue_creation() + request_issue_creation() fix_log_file() shutdown() \ No newline at end of file