-
Notifications
You must be signed in to change notification settings - Fork 0
/
create.sh
executable file
·52 lines (44 loc) · 1.01 KB
/
create.sh
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
set -e
docker build --platform=linux/amd64 . -t sigpwny/pwn-docker
read -p "Would you like to bind $HOME/ctf to /ctf in the container? [y/n] " -n 1 -r reply
echo
read -p "Would you like to start in the background? [y/n] " -n 1 -r background
echo
if [[ $background =~ ^[Yy]$ ]]
then
background_flag="-d"
command='/background-startup.sh'
else
background_flag=""
command='/container-startup.sh'
fi
if [[ $reply =~ ^[Yy]$ ]]
then
if [ ! -d "$HOME/ctf" ]; then
echo "Creating ~/ctf"
mkdir -p ~/ctf
fi
volume="-v $HOME/ctf:/ctf:rw"
destroy=""
else
volume="-v `pwd`:/ctf:rw"
destroy="--rm"
fi
echo $background_flag
docker run --interactive -t \
$volume \
$destroy \
--security-opt seccomp=unconfined \
--cap-add=SYS_PTRACE \
-p 1234:1234 \
-p 2222:22 \
--name pwn-docker \
sigpwny/pwn-docker \
$command \
$background_flag
if [[ $background =~ ^[Yy]$ ]]
then
echo "Started pwn-docker in the background"
echo "ssh -p 2222 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@localhost"
fi