77from lib .output import (
88 info ,
99 warning ,
10- error ,
1110 prompt ,
1211 misc_info
1312)
1615 load_api_keys ,
1716 check_services ,
1817 cmdline ,
18+ close ,
1919 EXPLOIT_FILES_PATH ,
20- START_APACHE_PATH ,
21- START_APACHE_OSX_PATH ,
22- START_POSTGRESQL_PATH ,
23- START_POSTGRESQL_OSX_PATH
20+ START_SERVICES_PATH
2421)
2522from lib .jsonize import load_exploits
2623
@@ -31,12 +28,12 @@ def main():
3128
3229 logo ()
3330 info ("welcome to autosploit, give us a little bit while we configure" )
31+ misc_info ("checking your running platform" )
32+ platform_running = platform .system ()
3433 misc_info ("checking for disabled services" )
35- # according to ps aux, postgre and apache2 are the names of the services
36-
37- if platform .system () == "Darwin" :
38- service_names = ("postgres" ,"httpd" )
39- elif platform .system () == "Linux" :
34+ # according to ps aux, postgre and apache2 are the names of the services on Linux systems
35+ service_names = ("postgres" , "apache2" )
36+ if "darwin" in platform_running .lower ():
4037 service_names = ("postgres" , "apache2" )
4138
4239 for service in list (service_names ):
@@ -48,22 +45,12 @@ def main():
4845 )
4946 if choice .lower ().startswith ("y" ):
5047 try :
51- if "postgre" in service :
52- if platform .system () == "Linux" :
53- cmdline ("sudo bash {}" .format (START_POSTGRESQL_PATH ))
54- elif platform .system () == "Darwin" :
55- cmdline ("sudo bash {}" .format (START_POSTGRESQL_OSX_PATH ))
56- else :
57- error ("Currently not supporting windows" )
58- sys .exit (1 )
48+ if "darwin" in platform_running .lower ():
49+ cmdline ("{} darwin" .format (START_SERVICES_PATH ))
50+ elif "linux" in platform_running .lower ():
51+ cmdline ("{} linux" .format (START_SERVICES_PATH ))
5952 else :
60- if platform .system () == "Linux" :
61- cmdline ("sudo bash {}" .format (START_APACHE_PATH ))
62- elif platform .system () == "Darwin" :
63- cmdline ("sudo bash {}" .format (START_APACHE_OSX_PATH ))
64- else :
65- error ("Currently not supporting windows" )
66- sys .exit (1 )
53+ close ("your platform is not supported by AutoSploit at this time" , status = 2 )
6754
6855 # moving this back because it was funky to see it each run
6956 info ("services started successfully" )
@@ -72,13 +59,12 @@ def main():
7259 except psutil .NoSuchProcess :
7360 pass
7461 else :
75- error (
62+ close (
7663 "service {} is required to be started for autosploit to run successfully (you can do it manually "
7764 "by using the command `sudo service {} start`), exiting" .format (
7865 service .title (), service
7966 )
8067 )
81- sys .exit (1 )
8268
8369 if len (sys .argv ) > 1 :
8470 info ("attempting to load API keys" )
0 commit comments