Skip to content

Commit e5a45a0

Browse files
committed
minor updates
1 parent 6b37171 commit e5a45a0

4 files changed

Lines changed: 40 additions & 3 deletions

File tree

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,3 @@ uid.p
77
etc/tokens/*
88
autosploit_out/*
99
venv/*
10-
etc/json/*

lib/banner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
import random
33

4-
VERSION = "2.2.4"
4+
VERSION = "2.2.5"
55

66

77
def banner_1(line_sep="#--", space=" " * 30):

lib/cmdline/cmd.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,25 @@ def single_run_args(opt, keys, loaded_modules):
141141
"You should take this ethical lesson into consideration "
142142
"before you continue with the use of this tool:\n\n{}\n".format(ethic))
143143
if opt.downloadModules is not None:
144-
print "downloading MODULES!"
144+
import re
145+
146+
modules_to_download = opt.downloadModules
147+
links_list = "{}/etc/text_files/links.txt".format(lib.settings.CUR_DIR)
148+
possibles = open(links_list).readlines()
149+
for module in modules_to_download:
150+
searcher = re.compile("{}".format(module))
151+
for link in possibles:
152+
if searcher.search(link) is not None:
153+
filename = lib.settings.download_modules(link.strip())
154+
download_filename = "{}.json".format(link.split("/")[-1].split(".")[0])
155+
download_path = "{}/etc/json".format(os.getcwd())
156+
current_files = os.listdir(download_path)
157+
if download_filename not in current_files:
158+
full_path = "{}/{}".format(download_path, download_filename)
159+
lib.jsonize.text_file_to_dict(filename, filename=full_path)
160+
lib.output.info("downloaded into: {}".format(download_path))
161+
else:
162+
lib.output.warning("file already downloaded, skipping")
145163
if opt.exploitList:
146164
try:
147165
lib.output.info("converting {} to JSON format".format(opt.exploitList))

lib/settings.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,3 +328,23 @@ def save_error_to_file(error_info, error_message, error_class):
328328
"Traceback (most recent call):\n " + error_info.strip() + "\n{}: {}".format(error_class, error_message)
329329
)
330330
return file_path
331+
332+
333+
def download_modules(link):
334+
import re
335+
import requests
336+
import tempfile
337+
338+
lib.output.info('downloading: {}'.format(link))
339+
retval = ""
340+
req = requests.get(link)
341+
content = req.content
342+
split_data = content.split(" ")
343+
searcher = re.compile("exploit/\w+/\w+")
344+
storage_file = tempfile.NamedTemporaryFile(delete=False)
345+
for item in split_data:
346+
if searcher.search(item) is not None:
347+
retval += item + "\n"
348+
with open(storage_file.name, 'a+') as tmp:
349+
tmp.write(retval)
350+
return storage_file.name

0 commit comments

Comments
 (0)