forked from WebGoat/WebGoat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
executable file
·52 lines (43 loc) · 1.67 KB
/
start.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
#!/bin/bash
cd /home/webgoat
function webgoat() {
echo "Starting WebGoat...."
java \
-Duser.home=/home/webgoat \
-Dfile.encoding=UTF-8 \
--add-opens java.base/java.lang=ALL-UNNAMED \
--add-opens java.base/java.util=ALL-UNNAMED \
--add-opens java.base/java.lang.reflect=ALL-UNNAMED \
--add-opens java.base/java.text=ALL-UNNAMED \
--add-opens java.desktop/java.beans=ALL-UNNAMED \
--add-opens java.desktop/java.awt.font=ALL-UNNAMED \
--add-opens java.base/sun.nio.ch=ALL-UNNAMED \
--add-opens java.base/java.io=ALL-UNNAMED \
--add-opens java.base/java.util=ALL-UNNAMED \
-Dwebgoat.host=0.0.0.0 -Dwebwolf.host=0.0.0.0 -Dwebgoat.port=8080 -Dwebwolf.port=9090 \
-jar webgoat.jar > webgoat.log
}
function write_start_message() {
until $(curl --output /dev/null --silent --head --fail http://0.0.0.0:8080/WebGoat/health); do
sleep 2
done
echo "
__ __ _ _____ _
\ \ / / | | / ____| | |
\ \ /\ / / ___ | |__ | | __ ___ __ _ | |_
\ \/ \/ / / _ \ | '_ \ | | |_ | / _ \ / _' | | __|
\ /\ / | __/ | |_) | | |__| | | (_) | | (_| | | |_
\/ \/ \___| |_.__/ \_____| \___/ \__,_| \__|
" >> webgoat.log
echo $'WebGoat successfully started...\n' >> webgoat.log
echo "NOTE: port numbers mentioned below may vary depending on your port mappings while starting the Docker container" >> webgoat.log
echo "Browse to http://localhost:8080/WebGoat to get started." >> webgoat.log
}
function tail_log_file() {
touch webgoat.log
tail -300f webgoat.log
}
commandline_args=("$@")
webgoat &
write_start_message &
tail_log_file