Skip to content

Commit 6976580

Browse files
authored
Merge pull request #660 from khast3x/dev-beta
Docker refactor
2 parents c5be609 + f02d510 commit 6976580

File tree

3 files changed

+29
-84
lines changed

3 files changed

+29
-84
lines changed

Docker/Dockerfile

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,17 @@
1-
FROM kalilinux/kali-linux-docker
1+
FROM phocean/msf
22

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
3+
COPY "entrypoint.sh" .
124

13-
RUN git clone https://github.com/NullArray/AutoSploit.git \
14-
&& pip install -r AutoSploit/requirements.txt
5+
RUN apt-get update && \
6+
apt-get install -y \
7+
git \
8+
python-dev \
9+
python-pip \
10+
apache2
1511

16-
COPY database.yml /root/.msf4/database.yml
17-
18-
WORKDIR AutoSploit
19-
20-
EXPOSE 80 443 4444
21-
22-
ENTRYPOINT ["python", "autosploit.py"]
23-
# ENTRYPOINT ["bash"]
12+
RUN chmod +x entrypoint.sh && \
13+
git clone https://github.com/NullArray/AutoSploit.git && \
14+
pip install -r AutoSploit/requirements.txt
15+
16+
EXPOSE 4444
17+
CMD [ "./entrypoint.sh" ]

Docker/README.md

Lines changed: 8 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,19 @@
11
# Docker deployment instructions
22

3-
## tl;dr
43

5-
Using [docker-compose](https://docs.docker.com/compose/install/):
4+
## From Dockerhub
65

76
```bash
8-
git clone https://github.com/NullArray/AutoSploit.git
9-
cd Autosploit/Docker
10-
docker-compose run --rm autosploit
7+
> docker run -it battlecl0ud/autosploit
118
```
129

13-
Using just Docker:
10+
*Ideally this is to be replaced by project author's dockerhub account*
1411

15-
```bash
16-
git clone https://github.com/NullArray/AutoSploit.git
17-
cd Autosploit/Docker
18-
# If you wish to edit default postgres service details, edit database.yml. Should work out of the box
19-
# nano database.yml
20-
docker network create -d bridge haknet
21-
docker run --network haknet --name msfdb -e POSTGRES_PASSWORD=s3cr3t -d postgres
22-
docker build -t autosploit .
23-
docker run -it --network haknet -p 80:80 -p 443:443 -p 4444:4444 autosploit
24-
```
25-
26-
## Abstract
27-
28-
- Launching `Autosploit` as a Docker container makes it very easy to use the tool in a hosted cloud environment (AWS, Azure, ...)
29-
- Separate `postgres` database into individual service for data persistence and potential async updating of the database
30-
- Create a small bridge network `haknet` so the service discovery is automatic
31-
- Launch `postgres` and `Autosploit` container, both linked by `haknet`
32-
- Autosploit will automatically launch preconfigured `msfconsole` to the external `postgres` container through `haknet` transparent network
33-
- Total image size of Kali + Metasploit + Autosploit : 1.75GB
34-
35-
## Deploy
36-
37-
### Step 1 - Create bridge network
38-
39-
This will enable the Metasploit Framework to talk to the `postgres` database using its hostname, making it abstract.
40-
41-
A Tor Socks Proxy can also be added to perform transparent proxy when launching exploits (not for reverse shells though, obviously).
42-
43-
```bash
44-
docker network create -d bridge haknet
45-
```
46-
47-
### Step 2 - Launch services
48-
49-
All automagically linked
50-
51-
#### Step 2.1 - Launch postgres
52-
53-
Launch a vanilla `postgres` service, linked to `haknet`
54-
55-
```bash
56-
docker run --network haknet --name msfdb -e POSTGRES_PASSWORD=s3cr3t -d postgres
57-
```
58-
59-
#### Step 2.2 - Launch Autosploit
60-
61-
Launch `Autosploit`.
62-
63-
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.
64-
65-
Please be aware that the first build will take some time (~10mn)
66-
67-
Building will be faster if done on a hosted server as it benefits from the -grade bandwidth
12+
## Build it yourself
6813

6914
```bash
70-
git clone https://github.com/NullArray/AutoSploit.git
71-
cd Autosploit/Docker
72-
nano database.yml # Exemple configuration should work fine
73-
docker build -t autosploit .
74-
docker run -it --network haknet -p 80:80 -p 443:443 -p 4444:4444 autosploit
15+
> git clone https://github.com/NullArray/AutoSploit.git
16+
> cd Autosploit/Docker
17+
> docker build -t autosploit .
18+
> docker run -it autosploit
7519
```

Docker/entrypoint.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
/etc/init.d/postgresql start
4+
/etc/init.d/apache2 start
5+
cd AutoSploit/
6+
7+
python autosploit.py

0 commit comments

Comments
 (0)