forked from PIG-007/pwnDockerAll
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dockerPwnRun
29 lines (24 loc) · 808 Bytes
/
dockerPwnRun
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#! /bin/bash
set -- `getopt g:h "$@"`
if [ $# == 1 ] ; then
echo "dockerPwnRun -h"
exit 1;
fi
while [ -n "$1" ]
do
case "$1" in
-g)sudo socat tcp-listen:"$2",reuseaddr,fork EXEC:dockerTerm,pty,raw,echo=0 &
shift ;;
-h)echo "Usage :dockerPwnRun [pwnfileDir] [docker_images_name]"
echo "Example :dockerPwnRun PIG007 2.23"
echo "Example(gdb) :dockerPwnRun PIG007 2.23 -g 30001"
exit 1;;
# -c) echo "found option c, no param." ;;
--) ;;
*) #echo "what's this?"
break ;;
esac
shift
done
sudo docker run -it --network host --name "$2" --rm --privileged=true -v $(pwd)/"$1":/ctf/"$1" "$2" /bin/bash -c 'cd /ctf/ && /bin/bash'
sudo ps -ef | grep dockerTerm | grep -v grep | awk '{print $2}'|sudo xargs -r kill