@@ -53,41 +53,47 @@ def main():
5353 misc_info ("checking for disabled services" )
5454 # according to ps aux, postgre and apache2 are the names of the services on Linux systems
5555 service_names = ("postgres" , "apache2" )
56- if "darwin" in platform_running .lower ():
57- service_names = ("postgres" , "apachectl" )
58-
59- for service in list (service_names ):
60- while not check_services (service ):
61- choice = prompt (
62- "it appears that service {} is not enabled, would you like us to enable it for you[y/N]" .format (
63- service .title ()
64- )
65- )
66- if choice .lower ().startswith ("y" ):
67- try :
68- if "darwin" in platform_running .lower ():
69- cmdline ("{} darwin" .format (START_SERVICES_PATH ))
70- elif "linux" in platform_running .lower ():
71- cmdline ("{} linux" .format (START_SERVICES_PATH ))
72- else :
73- close ("your platform is not supported by AutoSploit at this time" , status = 2 )
74-
75- # moving this back because it was funky to see it each run
76- info ("services started successfully" )
77- # this tends to show up when trying to start the services
78- # I'm not entirely sure why, but this fixes it
79- except psutil .NoSuchProcess :
80- pass
81- else :
82- process_start_command = "`sudo service {} start`"
56+ try :
57+ for service in list (service_names ):
58+ while not check_services (service ):
8359 if "darwin" in platform_running .lower ():
84- process_start_command = "`brew services start {}`"
85- close (
86- "service {} is required to be started for autosploit to run successfully (you can do it manually "
87- "by using the command {}), exiting" .format (
88- service .title (), process_start_command .format (service )
60+ info (
61+ "seems you're on macOS, skipping service checks "
62+ "(make sure that Apache2 and PostgreSQL are running)"
63+ )
64+ break
65+ choice = prompt (
66+ "it appears that service {} is not enabled, would you like us to enable it for you[y/N]" .format (
67+ service .title ()
8968 )
9069 )
70+ if choice .lower ().startswith ("y" ):
71+ try :
72+ if "darwin" in platform_running .lower ():
73+ cmdline ("{} darwin" .format (START_SERVICES_PATH ))
74+ elif "linux" in platform_running .lower ():
75+ cmdline ("{} linux" .format (START_SERVICES_PATH ))
76+ else :
77+ close ("your platform is not supported by AutoSploit at this time" , status = 2 )
78+
79+ # moving this back because it was funky to see it each run
80+ info ("services started successfully" )
81+ # this tends to show up when trying to start the services
82+ # I'm not entirely sure why, but this fixes it
83+ except psutil .NoSuchProcess :
84+ pass
85+ else :
86+ process_start_command = "`sudo service {} start`"
87+ if "darwin" in platform_running .lower ():
88+ process_start_command = "`brew services start {}`"
89+ close (
90+ "service {} is required to be started for autosploit to run successfully (you can do it manually "
91+ "by using the command {}), exiting" .format (
92+ service .title (), process_start_command .format (service )
93+ )
94+ )
95+ except Exception :
96+ pass
9197
9298 if len (sys .argv ) > 1 :
9399 info ("attempting to load API keys" )
@@ -107,7 +113,7 @@ def main():
107113 else :
108114 warning (
109115 "no arguments have been parsed, defaulting to terminal session. "
110- "press 99 to quit and help to get help"
116+ "press 99 to quit and type ` help` to view the help menus "
111117 )
112118 misc_info ("checking if there are multiple exploit files" )
113119 loaded_exploits = load_exploits (EXPLOIT_FILES_PATH )
@@ -121,11 +127,12 @@ def main():
121127 print (
122128 "\033 [31m[!] AutoSploit has hit an unhandled exception: '{}', "
123129 "in order for the developers to troubleshoot and repair the "
124- "issue AutoSploit will need to gather your OS information, metasploit version, "
130+ "issue AutoSploit will need to gather your OS information, "
125131 "current arguments, the error message, and a traceback. "
126132 "None of this information can be used to identify you in any way\033 [0m" .format (str (e ))
127133 )
128134 error_traceback = '' .join (traceback .format_tb (sys .exc_info ()[2 ]))
129- error_file = save_error_to_file (str (error_traceback ))
135+ error_class = str (e .__class__ ).split (" " )[1 ].split ("." )[1 ].strip (">" ).strip ("'" )
136+ error_file = save_error_to_file (str (error_traceback ), str (e ), error_class )
130137 request_issue_creation (error_file , hide_sensitive (), str (e ))
131138
0 commit comments