Skip to content

Commit 41a938e

Browse files
author
ekultek
committed
fixes the bug in sorting relevant modules (issue #141)
1 parent 158087b commit 41a938e

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

autosploit/main.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def main():
3232
try:
3333
is_admin = os.getuid() == 0
3434
except AttributeError:
35+
# we'll make it cross platform because it seems like a cool idea
3536
is_admin = ctypes.windll.shell32.IsUserAnAdmin() != 0
3637

3738
if not is_admin:
@@ -87,9 +88,6 @@ def main():
8788
loaded_tokens = load_api_keys()
8889
AutoSploitParser().parse_provided(opts)
8990

90-
# TODO[5] figure out why this isn't used anywhere
91-
# maybe we can just remove it, idk
92-
loaded_exploits = []
9391
if not opts.exploitFile:
9492
misc_info("checking if there are multiple exploit files")
9593
loaded_exploits = load_exploits(EXPLOIT_FILES_PATH)

lib/exploitation/exploiter.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,7 @@ def __init__(self, configuration, all_modules, hosts=None, **kwargs):
4444
# is run multiple times, it will not recreate the file and instead
4545
# opens an empty
4646
self.query = kwargs.get("query", lib.settings.QUERY_FILE_PATH)
47-
try:
48-
self.query_file = open(self.query).read()
49-
except:
50-
self.query_file = ""
47+
self.query_file = open(self.query).read()
5148
self.single = kwargs.get("single", None)
5249
self.ruby_exec = kwargs.get("ruby_exec", False)
5350
self.msf_path = kwargs.get("msf_path", None)

lib/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
RC_SCRIPTS_PATH = "{}/autosploit_out/".format(CUR_DIR)
3535

3636
# path to the file that will contain our query
37-
# QUERY_FILE_PATH = tempfile.NamedTemporaryFile(delete=False).name
37+
QUERY_FILE_PATH = tempfile.NamedTemporaryFile(delete=False).name
3838

3939
# default HTTP User-Agent
4040
DEFAULT_USER_AGENT = "AutoSploit/{} (Language=Python/{}; Platform={})".format(

lib/term/terminal.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,15 @@ def __config_headers():
307307
elif choice == 2:
308308
print(self.sep)
309309
query = lib.output.prompt("enter your search query", lowercase=False)
310-
with open(lib.settings.QUERY_FILE_PATH, "a+") as _query:
311-
_query.write(query)
310+
try:
311+
with open(lib.settings.QUERY_FILE_PATH, "w") as _query:
312+
_query.write(query)
313+
except AttributeError:
314+
filename = tempfile.NamedTemporaryFile(delete=False).name
315+
with open(filename, "w") as _query:
316+
_query.write(query)
317+
lib.settings.QUERY_FILE_PATH = filename
318+
print lib.settings.QUERY_FILE_PATH
312319
proxy, agent = __config_headers()
313320
# possibly needs to change here (see TODO[2])
314321
self.gather_hosts(query, proxy=proxy, agent=agent)

0 commit comments

Comments
 (0)