Skip to content

Commit b5b0c9f

Browse files
authored
Merge pull request #88 from NullArray/service-edits
Updates the services check
2 parents e2dd4c3 + 979e100 commit b5b0c9f

4 files changed

Lines changed: 48 additions & 16 deletions

File tree

autosploit/main.py

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
import sys
22

3+
import psutil
4+
35
from lib.cmdline.cmd import AutoSploitParser
46
from lib.term.terminal import AutoSploitTerminal
57
from lib.output import (
68
info,
79
warning,
810
error,
9-
prompt
11+
prompt,
12+
misc_info
1013
)
1114
from lib.settings import (
1215
logo,
@@ -26,32 +29,47 @@ def main():
2629

2730
logo()
2831
info("welcome to autosploit, give us a little bit while we configure")
29-
info("checking for services")
32+
misc_info("checking for disabled services")
3033
# according to ps aux, postgre and apache2 are the names of the services
3134
service_names = ("postgres", "apache2")
3235
for service in list(service_names):
3336
while not check_services(service):
34-
choice = prompt("it appears that service {} is not enabled, would you like us to enable it for you[y/N]".format(service))
37+
choice = prompt(
38+
"it appears that service {} is not enabled, would you like us to enable it for you[y/N]".format(
39+
service.title()
40+
)
41+
)
3542
if choice.lower().startswith("y"):
36-
if "postgre" in service:
37-
cmdline("sudo bash {}".format(START_POSTGRESQL_PATH))
38-
else:
39-
cmdline("sudo bash {}".format(START_APACHE_PATH))
43+
try:
44+
if "postgre" in service:
45+
cmdline("sudo bash {}".format(START_POSTGRESQL_PATH))
46+
else:
47+
cmdline("sudo bash {}".format(START_APACHE_PATH))
48+
# moving this back because it was funky to see it each run
49+
info("services started successfully")
50+
# this tends to show up when trying to start the services
51+
# I'm not entirely sure why, but this fixes it
52+
except psutil.NoSuchProcess:
53+
pass
4054
else:
41-
error("service {} is required to be started for autosploit to run, exiting".format(service.title()))
55+
error(
56+
"service {} is required to be started for autosploit to run successfully (you can do it manually "
57+
"by using the command `sudo service {} start`), exiting".format(
58+
service.title(), service
59+
)
60+
)
4261
sys.exit(1)
43-
info("services started successfully")
4462

4563
if len(sys.argv) > 1:
4664
info("attempting to load API keys")
4765
loaded_tokens = load_api_keys()
4866
AutoSploitParser().parse_provided(opts)
49-
info("checking if there are multiple exploit files")
67+
misc_info("checking if there are multiple exploit files")
5068
loaded_exploits = load_exploits(EXPLOIT_FILES_PATH)
5169
AutoSploitParser().single_run_args(opts, loaded_tokens, loaded_exploits)
5270
else:
5371
warning("no arguments have been parsed, defaulting to terminal session. press 99 to quit and help to get help")
54-
info("checking if there are multiple exploit files")
72+
misc_info("checking if there are multiple exploit files")
5573
loaded_exploits = load_exploits(EXPLOIT_FILES_PATH)
5674
info("attempting to load API keys")
5775
loaded_tokens = load_api_keys()

lib/banner.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
import random
23

34
VERSION = "2.0"
@@ -8,9 +9,9 @@ def banner_1(line_sep="#--", space=" " * 30):
89
{sep1}Author : Vector/NullArray | _ |_ _| |_ ___| __|___| |___|_| |_
910
{sep1}Twitter: @Real__Vector | | | | _| . |__ | . | | . | | _|
1011
{sep1}Type : Mass Exploiter |__|__|___|_| |___|_____| _|_|___|_|_|
11-
{sep1}Version: {v_num} |_|
12+
{sep1}Version: {v_num}{spacer} |_|
1213
##############################################\033[0m
13-
""".format(sep1=line_sep, v_num=VERSION, space_sep=space)
14+
""".format(sep1=line_sep, v_num=VERSION, space_sep=space, spacer=" " * 8)
1415
return banner
1516

1617

@@ -114,4 +115,15 @@ def banner_main():
114115
banner_5, banner_4,
115116
banner_3, banner_2, banner_1
116117
]
117-
return random.choice(banners)()
118+
if os.getenv("Graffiti", False):
119+
return banner_5()
120+
elif os.getenv("AutosploitOG", False):
121+
return banner_1()
122+
elif os.getenv("Nuclear", False):
123+
return banner_4()
124+
elif os.getenv("SploitaSaurusRex", False):
125+
return banner_3()
126+
elif os.getenv("Autosploit2", False):
127+
return banner_2()
128+
else:
129+
return random.choice(banners)()

lib/cmdline/cmd.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ def __init__(self):
1919

2020
@staticmethod
2121
def optparser():
22+
2223
"""
23-
the options object for our parser
24+
the options function for our parser, it will put everything into play
2425
"""
26+
2527
parser = argparse.ArgumentParser(
2628
usage="python autosploit.py -[c|z|s|a] -[q] QUERY\n"
2729
"{spacer}[-C] WORKSPACE LHOST LPORT [-e]\n"

lib/output.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def warning(text):
3535

3636
def misc_info(text):
3737
print(
38-
"[\033[96mi\033[0m] {}".format(
38+
"[\033[90mi\033[0m] {}".format(
3939
text
4040
)
4141
)

0 commit comments

Comments
 (0)