diff --git a/autosploit/main.py b/autosploit/main.py index 58e7694..83b4ae9 100644 --- a/autosploit/main.py +++ b/autosploit/main.py @@ -1,6 +1,6 @@ import sys - import psutil +import platform from lib.cmdline.cmd import AutoSploitParser from lib.term.terminal import AutoSploitTerminal @@ -18,7 +18,9 @@ cmdline, EXPLOIT_FILES_PATH, START_APACHE_PATH, - START_POSTGRESQL_PATH + START_APACHE_OSX_PATH, + START_POSTGRESQL_PATH, + START_POSTGRESQL_OSX_PATH ) from lib.jsonize import load_exploits @@ -31,7 +33,12 @@ def main(): info("welcome to autosploit, give us a little bit while we configure") misc_info("checking for disabled services") # according to ps aux, postgre and apache2 are the names of the services - service_names = ("postgres", "apache2") + + if platform.system() == "Darwin": + service_names = ("postgres","httpd") + elif platform.system() == "Linux": + service_names = ("postgres", "apache2") + for service in list(service_names): while not check_services(service): choice = prompt( @@ -42,9 +49,22 @@ def main(): if choice.lower().startswith("y"): try: if "postgre" in service: - cmdline("sudo bash {}".format(START_POSTGRESQL_PATH)) + if platform.system() == "Linux": + cmdline("sudo bash {}".format(START_POSTGRESQL_PATH)) + elif platform.system() == "Darwin": + cmdline("sudo bash {}".format(START_POSTGRESQL_OSX_PATH)) + else: + error("Currently not supporting windows") + sys.exit(1) else: - cmdline("sudo bash {}".format(START_APACHE_PATH)) + if platform.system() == "Linux": + cmdline("sudo bash {}".format(START_APACHE_PATH)) + elif platform.system() == "Darwin": + cmdline("sudo bash {}".format(START_APACHE_OSX_PATH)) + else: + error("Currently not supporting windows") + sys.exit(1) + # moving this back because it was funky to see it each run info("services started successfully") # this tends to show up when trying to start the services diff --git a/etc/scripts/start_apache_osx.sh b/etc/scripts/start_apache_osx.sh new file mode 100644 index 0000000..1e74ae7 --- /dev/null +++ b/etc/scripts/start_apache_osx.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +sudo apachectl start diff --git a/etc/scripts/start_postgre_osx.sh b/etc/scripts/start_postgre_osx.sh new file mode 100644 index 0000000..8812af6 --- /dev/null +++ b/etc/scripts/start_postgre_osx.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +brew services restart postgresql diff --git a/lib/settings.py b/lib/settings.py index ba136c6..7e28523 100644 --- a/lib/settings.py +++ b/lib/settings.py @@ -27,9 +27,15 @@ # path to the bash script to stack the PostgreSQL service START_POSTGRESQL_PATH = "{}/etc/scripts/start_postgre.sh".format(CUR_DIR) +# path to the bash script to stack the PostgreSQL service on OSX +START_POSTGRESQL_OSX_PATH = "{}/etc/scripts/start_postgre_osx.sh".format(CUR_DIR) + # path to the bash script to start the Apache service START_APACHE_PATH = "{}/etc/scripts/start_apache.sh".format(CUR_DIR) +# path to the bash script to start the Apache service on OSX +START_APACHE_PATH = "{}/etc/scripts/start_apache_osx.sh".format(CUR_DIR) + # path to the file that will contain our query QUERY_FILE_PATH = tempfile.NamedTemporaryFile(delete=False).name