Skip to content

Commit 7fcb2dc

Browse files
authored
Merge pull request #321 from NullArray/dev-beta
New Years Update. Happy new year everyone!
2 parents 7d6a577 + 3cefb72 commit 7fcb2dc

File tree

16 files changed

+729
-366
lines changed

16 files changed

+729
-366
lines changed

.github/.translations/README-de.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ misc arguments:
152152
Falls du AutoSploit auf einem System mit macOS ausführen willst, musst du das Programm trotz der Kompatibilität mit macOS in einer virtuellen Maschine ausführen, sodass es erfolgreich ausgeführt werden kann. Um dies zu tun, sind folgende Schritte nötig;
153153

154154
```bash
155-
sudo -s << '_EOF'
155+
sudo -s << '_EOF'
156156
pip2 install virtualenv --user
157157
git clone https://github.com/NullArray/AutoSploit.git
158158
virtualenv <PFAD-ZU-DEINER-ENV>
@@ -173,12 +173,13 @@ AutoSploit benötigt die folgenden Python 2.7 Module:
173173
```
174174
requests
175175
psutil
176+
beautifulsoup4
176177
```
177178

178179
Wenn dir auffällt, dass du diese nicht installiert hast, kannst du sie über Pip installieren, wie nachfolgend gezeigt.
179180

180181
```bash
181-
pip install requests psutil
182+
pip install requests psutil beautifulsoup4
182183
```
183184

184185
oder

.github/.translations/README-fr.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Comme vous pouvez l'imaginer au vu du nom de ce projet, AutoSploit automatise l'exploitation d'hôtes distantes connectées à internet. Les adresses des hôtes à attaquer sont collectées automatiquement grâce à l'aide de Shodan, Censys et Zoomeye. Vous pouvez également utiliser vos propres listes de cibles.
44
Les modules Metasploit disponibles ont été sélectionnés afin de faciliter l'obtention d'exécution de code à distance ( Remote Code Execution, ou RCE ), qui permettent ensuite de créer des sessions terminal inversées ( reverse shell ) ou meterpreter ( via metasploit ).
55

6-
**Ne soyez pas stupides**
6+
**Ne soyez pas stupides**
77

88
Recevoir les connexions de vos victimes directement sur votre ordinateur n'est pas vraiment une bonne idée. Vous devriez considérer l'option de dépenser quelques euros dans un VPS ( ou VPN ).
99

@@ -127,12 +127,13 @@ AutoSploit exige la présence des modules Python2.7 suivants.
127127
```
128128
requests
129129
psutil
130+
beautifulsoup4
130131
```
131132

132133
Si vous ne les avez pas, vous pouvez les installer avec les commandes ci-dessous ( dans le dossier d'AutoSploit ):
133134

134135
```bash
135-
pip install requests psutil
136+
pip install requests psutil beautifulsoup4
136137
```
137138

138139
ou

Docker/Dockerfile

+15-9
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
FROM kalilinux/kali-linux-docker
22

3-
RUN apt update && apt install -y postgresql \
4-
apache2 \
5-
python-pip \
6-
python-dev \
7-
build-essential \
8-
git \
9-
metasploit-framework
3+
RUN apt update \
4+
&& apt install -y \
5+
apache2 \
6+
build-essential \
7+
git \
8+
metasploit-framework \
9+
postgresql \
10+
python-dev \
11+
python-pip
12+
13+
RUN git clone https://github.com/NullArray/AutoSploit.git \
14+
&& pip install -r AutoSploit/requirements.txt
1015

11-
RUN git clone https://github.com/NullArray/AutoSploit.git && pip install requests psutil
1216
COPY database.yml /root/.msf4/database.yml
17+
1318
WORKDIR AutoSploit
19+
1420
EXPOSE 80 443 4444
1521

1622
ENTRYPOINT ["python", "autosploit.py"]
17-
#ENTRYPOINT ["bash"]
23+
# ENTRYPOINT ["bash"]

api_calls/censys.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def __init__(self, identity=None, token=None, query=None, proxy=None, agent=None
2424
self.host_file = HOST_FILE
2525
self.save_mode = save_mode
2626

27-
def censys(self):
27+
def search(self):
2828
"""
2929
connect to the Censys API and pull all IP addresses from the provided query
3030
"""

api_calls/shodan.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def __init__(self, token=None, query=None, proxy=None, agent=None, save_mode=Non
2525
self.host_file = HOST_FILE
2626
self.save_mode = save_mode
2727

28-
def shodan(self):
28+
def search(self):
2929
"""
3030
connect to the API and grab all IP addresses associated with the provided query
3131
"""

api_calls/zoomeye.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def __get_auth(self):
5454
token = json.loads(req.content)
5555
return token
5656

57-
def zoomeye(self):
57+
def search(self):
5858
"""
5959
connect to the API and pull all the IP addresses that are associated with the
6060
given query

autosploit/main.py

+3-9
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ def main():
6969
)
7070
if choice.lower().startswith("y"):
7171
try:
72-
if "darwin" in platform_running.lower():
73-
cmdline("{} darwin".format(START_SERVICES_PATH))
74-
elif "linux" in platform_running.lower():
72+
if "linux" in platform_running.lower():
7573
cmdline("{} linux".format(START_SERVICES_PATH))
7674
else:
7775
close("your platform is not supported by AutoSploit at this time", status=2)
@@ -111,16 +109,12 @@ def main():
111109

112110
AutoSploitParser().single_run_args(opts, loaded_tokens, loaded_exploits)
113111
else:
114-
warning(
115-
"no arguments have been parsed, defaulting to terminal session. "
116-
"press 99 to quit and type `help` to view the help menus"
117-
)
118112
misc_info("checking if there are multiple exploit files")
119113
loaded_exploits = load_exploits(EXPLOIT_FILES_PATH)
120114
info("attempting to load API keys")
121115
loaded_tokens = load_api_keys()
122-
terminal = AutoSploitTerminal(loaded_tokens)
123-
terminal.terminal_main_display(loaded_exploits)
116+
terminal = AutoSploitTerminal(loaded_tokens, loaded_exploits)
117+
terminal.terminal_main_display(loaded_tokens)
124118
except Exception as e:
125119
import traceback
126120

etc/scripts/start_services.sh

-11
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,10 @@ function startPostgreSQLLinux () {
1111
sudo systemctl start postgresql > /dev/null 2>&1
1212
}
1313

14-
function startApacheOSX () {
15-
sudo apachectl start > /dev/null 2>&1
16-
}
17-
18-
function startPostgreSQLOSX () {
19-
brew services restart postgresql > /dev/null 2>&1
20-
}
21-
2214
function main () {
2315
if [ $1 == "linux" ]; then
2416
startApacheLinux;
2517
startPostgreSQLLinux;
26-
elif [ $1 == "darwin" ]; then
27-
startApacheOSX;
28-
startPostgreSQLOSX;
2918
else
3019
echo "[*] invalid operating system";
3120
fi

etc/text_files/gen

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Usage of AutoSploit for attacking targets without prior mutual consent is illegal in pretty much every sense of the word. It is the
2+
end user's responsibility to obey all applicable local, state, and federal laws. Developers assume no liability and are not responsible
3+
for any misuse or damage caused by this program or any component thereof.
4+
5+
Developers do not encourage nor condone any illegal activity;
6+
7+
In OffSec/RedTeam engagements it is important however to mind your operational security. With that in mind, please consider the following:
8+
9+
- Use AutoSploit on a VPS through a proxy(chain) or Tor
10+
- Keep calm and wipe/data-poison the logs or use tools to do so
11+
- Never connect from your local IP address
12+
- Keep a low profile, AutoSploit is loud
13+
14+
15+
In closing, knowledge is not illegal and anybody that tells you learning is wrong is a fool.
16+
Get as much out of this program as we got from writing it. Remember though, common sense and a sense of ethics go a long way.
17+
18+
Thank you.

lib/banner.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
import random
33

4-
VERSION = "2.2.3"
4+
VERSION = "3.0"
55

66

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

lib/cmdline/cmd.py

+25-7
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))
@@ -169,33 +187,33 @@ def single_run_args(opt, keys, loaded_modules):
169187
keys["censys"][1], keys["censys"][0],
170188
opt.searchQuery, proxy=headers[0], agent=headers[1],
171189
save_mode=search_save_mode
172-
).censys()
190+
).search()
173191
if opt.searchZoomeye:
174192
lib.output.info(single_search_msg.format("Zoomeye"))
175193
api_searches[0](
176194
opt.searchQuery, proxy=headers[0], agent=headers[1],
177195
save_mode=search_save_mode
178-
).zoomeye()
196+
).search()
179197
if opt.searchShodan:
180198
lib.output.info(single_search_msg.format("Shodan"))
181199
api_searches[1](
182200
keys["shodan"][0], opt.searchQuery, proxy=headers[0], agent=headers[1],
183201
save_mode=search_save_mode
184-
).shodan()
202+
).search()
185203
if opt.searchAll:
186204
lib.output.info("searching all search engines in order")
187205
api_searches[0](
188206
opt.searchQuery, proxy=headers[0], agent=headers[1],
189207
save_mode=search_save_mode
190-
).zoomeye()
208+
).search()
191209
api_searches[1](
192210
keys["shodan"][0], opt.searchQuery, proxy=headers[0], agent=headers[1],
193211
save_mode=search_save_mode
194-
).shodan()
212+
).search()
195213
api_searches[2](
196214
keys["censys"][1], keys["censys"][0], opt.searchQuery, proxy=headers[0], agent=headers[1],
197215
save_mode=search_save_mode
198-
).censys()
216+
).search()
199217
if opt.startExploit:
200218
hosts = open(lib.settings.HOST_FILE).readlines()
201219
if opt.whitelist:

lib/creation/issue_creator.py

+5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import re
2+
import os
23
import sys
34
import json
45
import platform
@@ -165,5 +166,9 @@ def request_issue_creation(path, arguments, error_message):
165166
lib.output.error(
166167
"someone has already created this issue here: {}".format(find_url(identifier))
167168
)
169+
try:
170+
os.remove(path)
171+
except:
172+
pass
168173
else:
169174
lib.output.info("the issue has been logged to a file in path: '{}'".format(path))

lib/exploitation/exploiter.py

+12-8
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def whitelist_wash(hosts, whitelist_file):
2929
washed_hosts.append(host)
3030

3131
return washed_hosts
32-
except Exception:
32+
except IOError:
3333
lib.output.warning("unable to whitewash host list, does the file exist?")
3434
return hosts
3535

@@ -78,7 +78,11 @@ def start_exploit(self, sep="*" * 10):
7878

7979
today_printable = datetime.datetime.today().strftime("%Y-%m-%d_%Hh%Mm%Ss")
8080
current_run_path = path.join(lib.settings.RC_SCRIPTS_PATH, today_printable)
81-
makedirs(current_run_path)
81+
try:
82+
makedirs(current_run_path)
83+
except OSError:
84+
current_run_path = path.join(lib.settings.RC_SCRIPTS_PATH, today_printable + "(1)")
85+
makedirs(current_run_path)
8286

8387
report_path = path.join(current_run_path, "report.csv")
8488
with open(report_path, 'w') as f:
@@ -127,14 +131,14 @@ def start_exploit(self, sep="*" * 10):
127131
"set rhost {rhost}\n"
128132
"set rhosts {rhosts}\n"
129133
"run -z\n"
130-
"exit\n"
134+
"exit -y\n"
131135
)
132136

133-
module_name=mod.strip()
134-
workspace=self.configuration[0]
135-
lhost=self.configuration[1]
136-
lport=self.configuration[2]
137-
rhost=host.strip()
137+
module_name = mod.strip()
138+
workspace = self.configuration[0]
139+
lhost = self.configuration[1]
140+
lport = self.configuration[2]
141+
rhost = host.strip()
138142

139143
current_rc_script_path = path.join(current_host_path, mod.replace("/", '-').strip())
140144
with open(current_rc_script_path, 'w') as f:

lib/jsonize.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def load_exploits(path, node="exploits"):
5858
try:
5959
selected_file = file_list[int(action) - 1]
6060
selected = True
61-
except Exception:
61+
except Except:
6262
lib.output.warning("invalid selection ('{}'), select from below".format(action))
6363
selected = False
6464
else:

0 commit comments

Comments
 (0)