Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 25 additions & 5 deletions autosploit/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys

import psutil
import platform

from lib.cmdline.cmd import AutoSploitParser
from lib.term.terminal import AutoSploitTerminal
Expand All @@ -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

Expand All @@ -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(
Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions etc/scripts/start_apache_osx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

sudo apachectl start
3 changes: 3 additions & 0 deletions etc/scripts/start_postgre_osx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

brew services restart postgresql
6 changes: 6 additions & 0 deletions lib/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down