Skip to content

Commit f178eff

Browse files
authored
Merge pull request #81 from NullArray/dev-beta
merging changes to master
2 parents 7c0ea6b + 9c96a19 commit f178eff

File tree

2 files changed

+21
-28
lines changed

2 files changed

+21
-28
lines changed

autosploit/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def main():
3030
service_names = ("postgresql", "apache")
3131
for service in list(service_names):
3232
if not check_services(service):
33-
choice = prompt("it appears that service {} is not enabled, would you like us to enable it for you[y/N]")
33+
choice = prompt("it appears that service {} is not enabled, would you like us to enable it for you[y/N]".format(service))
3434
if choice.lower().startswith("y"):
3535
if "postgre" in service:
3636
cmdline("sudo bash {}".format(START_POSTGRESQL_PATH))

lib/settings.py

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,22 @@
1313
import lib.output
1414
import lib.banner
1515

16+
CUR_DIR = "{}".format(os.getcwd())
1617

1718
# path to the file containing all the discovered hosts
18-
HOST_FILE = "{}/hosts.txt".format(os.getcwd())
19+
HOST_FILE = "{}/hosts.txt".format(CUR_DIR)
1920

2021
# path to the folder containing all the JSON exploit modules
21-
EXPLOIT_FILES_PATH = "{}/etc/json".format(os.getcwd())
22+
EXPLOIT_FILES_PATH = "{}/etc/json".format(CUR_DIR)
2223

2324
# path to the usage and legal file
24-
USAGE_AND_LEGAL_PATH = "{}/etc/text_files/general".format(os.getcwd())
25+
USAGE_AND_LEGAL_PATH = "{}/etc/text_files/general".format(CUR_DIR)
2526

2627
# path to the bash script to stack the PostgreSQL service
27-
START_POSTGRESQL_PATH = "{}/etc/scripts/start_postgre.sh".format(os.getcwd())
28+
START_POSTGRESQL_PATH = "{}/etc/scripts/start_postgre.sh".format(CUR_DIR)
2829

2930
# path to the bash script to start the Apache service
30-
START_APACHE_PATH = "{}/etc/scripts/start_apache.sh".format(os.getcwd())
31+
START_APACHE_PATH = "{}/etc/scripts/start_apache.sh".format(CUR_DIR)
3132

3233
# path to the file that will contain our query
3334
QUERY_FILE_PATH = tempfile.NamedTemporaryFile(delete=False).name
@@ -45,8 +46,8 @@
4546

4647
# all the paths to the API tokens
4748
API_KEYS = {
48-
"censys": ("{}/etc/tokens/censys.key".format(os.getcwd()), "{}/etc/tokens/censys.id".format(os.getcwd())),
49-
"shodan": ("{}/etc/tokens/shodan.key".format(os.getcwd()), )
49+
"censys": ("{}/etc/tokens/censys.key".format(CUR_DIR), "{}/etc/tokens/censys.id".format(CUR_DIR)),
50+
"shodan": ("{}/etc/tokens/shodan.key".format(CUR_DIR), )
5051
}
5152

5253
# all the URLs that we will use while doing the searching
@@ -80,8 +81,7 @@ def validate_ip_addr(provided):
8081
return True
8182
except:
8283
return False
83-
else:
84-
return False
84+
return False
8585

8686

8787
def check_services(service_name):
@@ -109,11 +109,8 @@ def write_to_file(data_to_write, filename, mode="a+"):
109109
is_append = lib.output.prompt("would you like to (a)ppend or (o)verwrite the file")
110110
if is_append == "o":
111111
mode = "w"
112-
elif is_append == "a":
113-
mode = "a+"
114-
else:
112+
elif is_append != "a":
115113
lib.output.warning("invalid input provided ('{}'), appending to file".format(is_append))
116-
mode = "a+"
117114
with open(filename, mode) as log:
118115
if isinstance(data_to_write, (tuple, set, list)):
119116
for item in list(data_to_write):
@@ -124,20 +121,18 @@ def write_to_file(data_to_write, filename, mode="a+"):
124121
return filename
125122

126123

127-
def load_api_keys(path="{}/etc/tokens".format(os.getcwd())):
124+
def load_api_keys(path="{}/etc/tokens".format(CUR_DIR)):
128125

129126
"""
130127
load the API keys from their .key files
131128
"""
132129

133-
def makedir(dir):
134-
"""
135-
make the directory if it does not exist
136-
"""
137-
if not os.path.exists(dir):
138-
os.mkdir(dir)
130+
"""
131+
make the directory if it does not exist
132+
"""
133+
if not os.path.exists(path):
134+
os.mkdir(path)
139135

140-
makedir(path)
141136
for key in API_KEYS.keys():
142137
if not os.path.isfile(API_KEYS[key][0]):
143138
access_token = lib.output.prompt("enter your {} API token".format(key.title()), lowercase=False)
@@ -179,10 +174,7 @@ def check_for_msf():
179174
"""
180175
check the ENV PATH for msfconsole
181176
"""
182-
in_env = os.getenv("msfconsole", False)
183-
if not in_env:
184-
return False
185-
177+
return os.getenv("msfconsole", False)
186178

187179
def logo():
188180
"""
@@ -200,8 +192,10 @@ def animation(text):
200192
global stop_animation
201193
i = 0
202194
while not stop_animation:
195+
"""
203196
if stop_animation is True:
204197
print("\n")
198+
"""
205199
temp_text = list(text)
206200
if i >= len(temp_text):
207201
i = 0
@@ -236,13 +230,12 @@ def close(warning, status=1):
236230
lib.output.error(warning)
237231
sys.exit(status)
238232

239-
240233
def grab_random_agent():
241234
"""
242235
get a random HTTP User-Agent
243236
"""
244237
user_agent_path = "{}/etc/text_files/agents.txt"
245-
with open(user_agent_path.format(os.getcwd())) as agents:
238+
with open(user_agent_path.format(CUR_DIR)) as agents:
246239
return random.choice(agents.readlines()).strip()
247240

248241

0 commit comments

Comments
 (0)