2023-05-03 10:02:05 -05:00
# Folder Purpose
This folder contains files related to running Metasploit inside Docker.
2016-07-18 12:38:57 -06:00
# Metasploit in Docker
## Getting Started
To run `msfconsole`
``` bash
2018-02-17 20:12:35 +01:00
./docker/bin/msfconsole
2016-07-18 12:38:57 -06:00
```
2018-02-17 20:12:35 +01:00
2017-11-28 21:35:20 +01:00
or
2018-02-17 20:12:35 +01:00
2016-07-18 12:38:57 -06:00
``` bash
2018-02-17 20:12:35 +01:00
docker-compose build
docker-compose run --rm --service-ports -e MSF_UID = $( id -u) -e MSF_GID = $( id -g) ms
2016-07-18 12:38:57 -06:00
```
2017-11-28 21:35:20 +01:00
To run `msfvenom`
2016-07-18 12:38:57 -06:00
``` bash
2018-02-17 20:12:35 +01:00
./docker/bin/msfvenom
2016-07-18 12:38:57 -06:00
```
2018-02-17 20:12:35 +01:00
2017-11-28 21:35:20 +01:00
or
2018-02-17 20:12:35 +01:00
2017-04-05 20:38:42 +02:00
``` bash
2018-02-17 20:12:35 +01:00
docker-compose build
docker-compose run --rm --no-deps -e MSF_UID = $( id -u) -e MSF_GID = $( id -g) ms ./msfvenom
2017-04-05 20:38:42 +02:00
```
2017-11-28 21:35:20 +01:00
You can pass any command line arguments to the binstubs or the docker-compose command and they will be passed to `msfconsole` or `msfvenom` . If you need to rebuild an image (for example when the Gemfile changes) you need to build the docker image using `docker-compose build` or supply the `--rebuild` parameter to the binstubs.
2016-07-18 12:38:57 -06:00
### But I want reverse shells...
2017-11-28 21:35:20 +01:00
By default we expose port `4444` .
2016-07-18 12:38:57 -06:00
If you want to expose more ports, or have `LHOST` prepopulated with a specific
value; you'll need to setup a local docker-compose override for this.
2017-11-28 21:35:20 +01:00
Create `docker-compose.local.override.yml` with:
2016-07-18 12:38:57 -06:00
``` yml
2017-11-28 21:35:20 +01:00
version : '3'
2016-07-18 12:38:57 -06:00
services :
ms :
environment :
# example of setting LHOST
LHOST : 10.0 .8 .2
# example of adding more ports
ports :
- 8080 : 8080
```
Make sure you set `LHOST` to valid hostname that resolves to your host machine.
Now you need to set the `COMPOSE_FILE` environment variable to load your local
override.
``` bash
2017-11-28 21:35:20 +01:00
echo "COMPOSE_FILE=./docker-compose.yml:./docker-compose.override.yml:./docker-compose.local.override.yml" >> .env
2016-07-18 12:38:57 -06:00
```
Now you should be able get reverse shells working