Skip to content

Instantly share code, notes, and snippets.

@zetc0de
Last active December 14, 2020 01:22
Show Gist options
  • Save zetc0de/65e4297b83da6b01db3e4bba9ea626aa to your computer and use it in GitHub Desktop.
Save zetc0de/65e4297b83da6b01db3e4bba9ea626aa to your computer and use it in GitHub Desktop.
zetlab autosetup
#!/bin/bash
# run with sudo
red="\e[1;31m"
reset="\033[00m"
bwapp="raesene/bwapp"
dvwa="citizenstig/dvwa"
nowasp="citizenstig/nowasp"
juiceshop="bkimminich/juice-shop"
bricks="citizenstig/owaspbricks "
sstichall="zetc0de/sstichall"
xvwa="tuxotron/xvwa"
lkwa="https://github.com/weev3/LKWA.git"
installDep() {
curl https://gist.githubusercontent.com/zetc0de/ba9277281bdc6e30ae4ddd179fc39b25/raw/795d9fc7fea32e3254ebd45fd592afa8908cf88e/docker-setup.sh | bash
}
setNginx() {
available="/etc/nginx/sites-available/${1}"
enable="/etc/nginx/sites-enabled/${1}"
if [[ ! -f $available ]]
then
cat <<ZET >> $available
server {
listen 80;
server_name ${1}.zetlab.pw;
location / {
proxy_pass http://127.0.0.1:${2};
}
}
ZET
ln -s $available $enable
fi
systemctl reload nginx
}
delContainer() {
# Delete All Container
echo -e "$red Delete All Container...$reset"
docker container stop $(docker container ls -aq)
docker container rm $(docker container ls -aq)
}
runImage() {
# Running BWAPP
echo -e "$red Running BWAPP...$reset"
docker run -d --name bwapp -p 127.0.0.1:3001:80 $bwapp
setNginx bwapp 3001
# Running DVWA
echo -e "$red Running DVWA...$reset"
docker run -d --name dvwa -p 127.0.0.1:3002:80 $dvwa
setNginx dvwa 3002
# Running Nowasp
echo -e "$red Running Nowasp...$reset"
docker run -d --name nowasp -p 127.0.0.1:3003:80 $nowasp
setNginx nowasp 3003
# Running Owasp Juice-shop
echo -e "$red Running Owasp Juice-shop...$reset"
docker run -d --name juiceshop -p 127.0.0.1:3004:3000 $juiceshop
setNginx juiceshop 3004
# Running Owasp Bricks
echo -e "$red Running Owasp Bricks...$reset"
docker run -d --name bricks -p 127.0.0.1:3005:80 $bricks
setNginx bricks 3005
# Running sstichall
echo -e "$red Running sstichall...$reset"
docker run -d --name sstichall -p 127.0.0.1:3006:5000 zetc0de/sstichall
setNginx sstichall 3006
# Running XVWA
echo -e "$red Running XVWA...$reset"
docker run -d --name xvwa -p 127.0.0.1:3007:80 tuxotron/xvwa
setNginx xvwa 3007
# Running LKWA
echo -e "$red Running LKWA...$reset"
cd ~
git clone $lkwa
cd LKWA
docker-compose up --detach
setNginx lkwa 3000
}
installDep
delContainer
runImage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment