Skip to content

Commit 0e1cd8a

Browse files
authored
Merge pull request #13 from khast3x/master
Fixed conflict: Added Dockerfile for easy cloud deploy
2 parents 57e6304 + a138767 commit 0e1cd8a

3 files changed

Lines changed: 91 additions & 0 deletions

File tree

Docker/Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM kalilinux/kali-linux-docker
2+
3+
RUN apt update && apt install -y postgresql \
4+
apache2 \
5+
python-pip \
6+
python-dev \
7+
build-essential \
8+
git \
9+
metasploit-framework
10+
11+
RUN git clone https://github.com/NullArray/AutoSploit.git && pip install shodan blessings
12+
COPY database.yml /root/.msf4/database.yml
13+
WORKDIR AutoSploit
14+
EXPOSE 80 443 4444
15+
16+
ENTRYPOINT ["python", "autosploit.py"]
17+
#ENTRYPOINT ["bash"]

Docker/README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
Docker deployment instructions
2+
=====
3+
4+
## tl;dr
5+
```bash
6+
git clone https://github.com/NullArray/AutoSploit.git
7+
cd Autosploit/Docker
8+
# If you wish to edit default postgres service details, edit database.yml. Should work out of the box
9+
# nano database.yml
10+
docker network create -d bridge haknet
11+
docker run --network haknet --name msfdb -e POSTGRES_PASSWORD=s3cr3t -d postgres
12+
docker run -it -p 80:80 -p 443:443 -p 4444:4444 autosploit
13+
```
14+
15+
16+
## Abstract
17+
18+
* Launching `Autosploit` as a Docker container makes it very easy to use the tool in a hosted cloud environment (AWS, Azure, ...)
19+
* Separate `postgres` database into individual service for data persistence and potential async updating of the database
20+
* Create a small bridge network ``haknet`` so the service discovery is automatic
21+
* Launch `postgres` and `Autosploit` container, both linked by `haknet`
22+
* Autosploit will automatically launch preconfigured `msfconsole` to the external `postgres` container through `haknet` transparent network
23+
* Total image size of Kali + Metasploit + Autosploit : 1.75GB
24+
25+
## Deploy
26+
27+
##### Step 1 - Create bridge network
28+
This will enable the Metasploit Framework to talk to the `postgres` database using its hostname, making it abstract.
29+
30+
A Tor Socks Proxy can also be added to perform transparent proxy when launching exploits (not for reverse shells though, obviously).
31+
32+
```bash
33+
docker network create -d bridge haknet
34+
```
35+
36+
##### Step 2 - Launch services
37+
38+
All automagically linked
39+
40+
41+
###### Step 2.1 - Launch postgres
42+
43+
Launch a vanilla `postgres` service, linked to `haknet`
44+
```bash
45+
docker run --network haknet --name msfdb -e POSTGRES_PASSWORD=s3cr3t -d postgres
46+
```
47+
###### Step 2.2 - Launch Autosploit
48+
49+
Launch `Autosploit`.
50+
51+
This Dockerfile will copy the default database config to ```~/.msf4/database.yml```. You can edit the configuration file `database.yml` to your liking before building.
52+
53+
Please be aware that the first build will take some time (~10mn)
54+
55+
Building will be faster if done on a hosted server as it benefits from the -grade bandwidth
56+
57+
```bash
58+
git clone https://github.com/NullArray/AutoSploit.git
59+
cd Autosploit/Docker
60+
nano database.yml # Exemple configuration should work fine
61+
docker run -it -p 80:80 -p 443:443 -p 4444:4444 autosploit
62+
```

Docker/database.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
development: &pgsql
2+
adapter: postgresql
3+
database: postgres
4+
username: postgres
5+
password: s3cr3t
6+
host: msfdb
7+
port: 5432
8+
pool: 200
9+
timeout: 5
10+
11+
production: &production
12+
<<: *pgsql

0 commit comments

Comments
 (0)