Created
May 16, 2016 11:15
-
-
Save libcrack/4e2407d8e0c5b218e499bddb1fb77366 to your computer and use it in GitHub Desktop.
Bash wrapper around docker and Metasploit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # root@libcrack.so | |
| # vie may 13 22:57:30 CEST 2016 | |
| # docker run -d --name msf \ | |
| # -p 127.0.0.1:1443:443 \ | |
| # -v ~/.msf4:/root/.msf4 \ | |
| # -v /tmp/msf:/tmp/data \ | |
| # remnux/metasploit | |
| # | |
| # docker run --rm -it -p 127.0.0.1:443:443 \ | |
| # -v ~/.msf4:/root/.msf4 \ | |
| # -v /tmp/msf:/tmp/data remnux/metasploit | |
| # | |
| # exit $? | |
| msf-docker(){ | |
| local name="msf" | |
| local repo="remnux/metasploit" | |
| local lhost="127.0.0.1:443:443" | |
| docker images | grep -q ^"$repo" 2>/dev/null || { | |
| printf "\e[31m[*]\e[0m Repository $repo not found locally\n" | |
| printf "\e[31m[*]\e[0m Please, pull the repo: docker pull $repo\n" | |
| exit 1 | |
| } | |
| case $1 in | |
| persistent) | |
| printf "\e[33m[*]\e[0m Running \e[1m${1}\e[0m container\n" | |
| docker run \ | |
| -d -p "$lhost" \ | |
| --name "$name" \ | |
| -v "~/.msf4:/root/.msf4" \ | |
| -v "/tmp/msf:/tmp/data" \ | |
| "$repo" | |
| ;; | |
| volatile) | |
| printf "\e[33m[*]\e[0m Running \e[1m${1}\e[0m container\n" | |
| docker run \ | |
| --rm -it -p "$lhost" | |
| -v "~/.msf4:/root/.msf4" \ | |
| -v "/tmp/msf:/tmp/data" \ | |
| "$repo" | |
| ;; | |
| *) printf "Usage: $FUNCname <persistent|volatile>\n"; exit 1 ;; | |
| esac | |
| return $? | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment