From b26d29108c0526badde3785f53190f0c070cc1cc Mon Sep 17 00:00:00 2001 From: ekultek Date: Wed, 1 Nov 2017 10:07:15 -0500 Subject: [PATCH] fixes an issue where the geckodriver will not connect, usually means something happened during the installation of it, will now attempt to re-install the geckodriver (issue #132) --- bin/unzip_gecko.py | 2 +- etc/checksum/md5sum.md5 | 6 +++--- lib/core/settings.py | 17 +++++++++++++++++ var/google_search/search.py | 23 ++++++++++++++++++++++- 4 files changed, 43 insertions(+), 5 deletions(-) diff --git a/bin/unzip_gecko.py b/bin/unzip_gecko.py index 1adc3d8..6a47f03 100644 --- a/bin/unzip_gecko.py +++ b/bin/unzip_gecko.py @@ -202,7 +202,7 @@ def main(rewrite="{}/bin/executed.txt", verbose=False): if not disclaimer(): exit(1) lib.core.settings.logger.info(lib.core.settings.set_color( - "seems this is your first time running the appication, " + "seems this is your first time running the application, " "doing setup please wait..." )) if verbose: diff --git a/etc/checksum/md5sum.md5 b/etc/checksum/md5sum.md5 index d966bd4..1f5f6dc 100644 --- a/etc/checksum/md5sum.md5 +++ b/etc/checksum/md5sum.md5 @@ -10,7 +10,7 @@ a3ee2d4610056c6fe270c2a74dda49f9 ./etc/dorks.txt b34aacdcb683a2de649c002601f53746 ./etc/xss_payloads.txt d41d8cd98f00b204e9800998ecf8427e ./bin/__init__.py -a19ac607db04a68fdbfc81d6c5a000d1 ./bin/unzip_gecko.py +ff2511effe21aa36002f37ed9bfe47ec ./bin/unzip_gecko.py dc1eb4ebe0f372af48b5a9c107ebc68d ./bin/drivers/geckodriver-v0.18.0-linux32.tar.gz be18faeea6e7db9db6990d8667e2298f ./bin/drivers/geckodriver-v0.17.0-linux64.tar.gz 79b1a158f96d29942a111c0905f1c807 ./bin/drivers/geckodriver-v0.17.0-linux32.tar.gz @@ -42,9 +42,9 @@ e2b494ba257444ed4a9a8a554dcbe250 ./lib/attacks/whois_lookup/whois.py f746d2867f493104a78d0540cf50c03f ./lib/attacks/intel_me/__init__.py 1faa2b5dfad6eb538bbfe42942d2a9da ./lib/core/errors.py d41d8cd98f00b204e9800998ecf8427e ./lib/core/__init__.py -20f53fc0b7c08efc83da348a8d5fff2b ./lib/core/settings.py +97bfe118adfdfc3ef02c5dca4c0aec62 ./lib/core/settings.py d41d8cd98f00b204e9800998ecf8427e ./var/google_search/__init__.py -5f9788e4421696fc1539e6b11cace04b ./var/google_search/search.py +2d984415adc457061e1757cbd79ea12b ./var/google_search/search.py d41d8cd98f00b204e9800998ecf8427e ./var/__init__.py d41d8cd98f00b204e9800998ecf8427e ./var/auto_issue/__init__.py 4506850a02aa18e12bef4efeb760ad9e ./var/auto_issue/github.py diff --git a/lib/core/settings.py b/lib/core/settings.py index 5cb854a..0641068 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -22,6 +22,7 @@ except ImportError: import psutil import requests +import whichcraft from lxml import etree import bin.unzip_gecko @@ -82,6 +83,8 @@ CLEANUP_TOOL_PATH = "{}/etc/scripts/cleanup.sh".format(os.getcwd()) LAUNCH_SQLMAP_API_TOOL = "{}/etc/scripts/launch_sqlmap_api.sh".format(os.getcwd()) # path to nmap installer NMAP_INSTALLER_TOOL = "{}/etc/scripts/install_nmap.sh".format(os.getcwd()) +# path to check if the program has been executed or not +EXECUTED_PATH = "{}/bin/executed.txt".format(os.getcwd()) # paths to sqlmap and nmap TOOL_PATHS = "{}/bin/paths/path_config.ini".format(os.getcwd()) # the log for found admin pages on a site @@ -701,3 +704,17 @@ def create_random_ip(): if generated == "0.0.0.0" or "255.255.255.255": generated = __get_nodes() return generated + + +def rewrite_all_paths(): + """ + rewrite all the paths in case we hit a certain error, this will force a reinstall of the + geckodriver + """ + gecko_path = whichcraft.which("geckodriver") + os.remove(gecko_path) + paths = (TOOL_PATHS, GECKO_VERSION_INFO_PATH) + for path in paths: + open(path, "w").close() + with open(EXECUTED_PATH, "w") as log: + log.write("FALSE") diff --git a/var/google_search/search.py b/var/google_search/search.py index 8d4f9c5..9775140 100644 --- a/var/google_search/search.py +++ b/var/google_search/search.py @@ -42,7 +42,8 @@ from lib.core.settings import ( URL_EXCLUDES, CLEANUP_TOOL_PATH, FIX_PROGRAM_INSTALL_PATH, - create_random_ip + create_random_ip, + rewrite_all_paths ) try: @@ -342,6 +343,26 @@ def parse_search_results(query, url_to_search, verbose=False, **kwargs): "you can automatically try and re-install Xvfb to fix the problem..." )) shutdown() + elif "Message: Reached error page:" in str(e): + logger.fatal(set_color( + "geckodriver has hit an error that usually means it needs to be reinstalled...", level=50 + )) + question = prompt( + "would you like to attempt a reinstallation of the geckodriver", opts="yN" + ) + if question.lower().startswith("y"): + logger.warning(set_color( + "rewriting all executed information, path information, and removing geckodriver...", level=30 + )) + rewrite_all_paths() + logger.info(set_color( + "all paths rewritten, you will be forced to re-install everything next run of Zeus..." + )) + else: + logger.fatal(set_color( + "you will need to remove the geckodriver from /usr/bin and reinstall it...", level=50 + )) + shutdown() else: logger.exception(set_color( "{} failed to gather the URL from search engine, caught exception '{}' "