Created
July 18, 2019 02:16
-
-
Save ropnop/c21c35e67a07da2ab50dbb8a085ccd22 to your computer and use it in GitHub Desktop.
Docker aliases
This file contains 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
function dockershell() { | |
docker run --rm -i -t --entrypoint=/bin/bash "$@" | |
} | |
function dockershellsh() { | |
docker run --rm -i -t --entrypoint=/bin/sh "$@" | |
} | |
function dockershellhere() { | |
dirname=${PWD##*/} | |
docker run --rm -it --entrypoint=/bin/bash -v `pwd`:/${dirname} -w /${dirname} "$@" | |
} | |
function dockershellshhere() { | |
docker run --rm -it --entrypoint=/bin/sh -v `pwd`:/${dirname} -w /${dirname} "$@" | |
} | |
function dockerwindowshellhere() { | |
dirname=${PWD##*/} | |
docker -c 2019-box run --rm -it -v "C:${PWD}:C:/source" -w "C:/source" "$@" | |
} | |
impacket() { | |
docker run --rm -it rflathers/impacket "$@" | |
} | |
smbservehere() { | |
local sharename | |
[[ -z $1 ]] && sharename="SHARE" || sharename=$1 | |
docker run --rm -it -p 445:445 -v "${PWD}:/tmp/serve" rflathers/impacket smbserver.py -smb2support $sharename /tmp/serve | |
} | |
nginxhere() { | |
docker run --rm -it -p 80:80 -p 443:443 -v "${PWD}:/srv/data" rflathers/nginxserve | |
} | |
webdavhere() { | |
docker run --rm -it -p 80:80 -v "${PWD}:/srv/data/share" rflathers/webdav | |
} | |
metasploit() { | |
docker run --rm -it -v "${HOME}/.msf4:/home/msf/.msf4" metasploitframework/metasploit-framework ./msfconsole "$@" | |
} | |
metasploitports() { | |
docker run --rm -it -v "${HOME}/.msf4:/home/msf/.msf4" -p 8443-8500:8443-8500 metasploitframework/metasploit-framework ./msfconsole "$@" | |
} | |
msfvenomhere() { | |
docker run --rm -it -v "${HOME}/.msf4:/home/msf/.msf4" -v "${PWD}:/data" metasploitframework/metasploit-framework ./msfvenom "$@" | |
} | |
reqdump() { | |
docker run --rm -it -p 80:3000 rflathers/reqdump | |
} | |
postfiledumphere() { | |
docker run --rm -it -p80:3000 -v "${PWD}:/data" rflathers/postfiledump | |
} |
Author
ropnop
commented
Jul 20, 2019
via email
Ah very nice! Thanks for sharing!
…On Fri, Jul 19, 2019 at 9:54 AM Miles Whittaker ***@***.***> wrote:
Just saw your post on docker aliases. Really liked it. Thought you
might appreciate this:
function msfvenom() {
local entrydir="/usr/src/metasploit-framework"
local image="metasploitframework/metasploit-framework:latest"
local name="msfvenom_$(head -c 8 /dev/random | xxd -p)"
mkdir -p "$HOME/.msf4"
docker run -e MSF_GID=$(id -g) -e MSF_UID=$(id -u) \
--entrypoint "$entrydir/docker/entrypoint.sh" -i \
--name "$name" --rm -tv "$HOME/.msf4":/home/msf/.msf4 \
-v "$(pwd)":/msf:Z -w /msf $image "$entrydir/msfvenom" "$@"
}
This allows you to get around that -o /data/... issue you mentioned.
It also might help in case of selinux shenanigans. The same can also
be used for msfconsole.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://gist.github.com/c21c35e67a07da2ab50dbb8a085ccd22?email_source=notifications&email_token=AATP44UKNPVFTNNUMM7RMPLQAHISXA5CNFSM4IFGYKEKYY3PNVWWK3TUL52HS4DFVNDWS43UINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAFVTAI#gistcomment-2975236>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AATP44WMYI7D6WFER5HE4QLQAHISXANCNFSM4IFGYKEA>
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment