forked from x41x41x41/WebGoat-AutoInstall
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
34 lines (26 loc) · 1.1 KB
/
setup.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
#!/bin/bash
#Get the files
wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/webgoat/WebGoat-5.4.war
wget http://mirror.vorboss.net/apache/tomcat/tomcat-7/v7.0.69/bin/apache-tomcat-7.0.69.tar.gz
#Get Java home
JAVALOC=$(readlink -f $(which java))
THROWOUT="jre/bin/java"
JAVAHOME=${JAVALOC%$THROWOUT}
#echo $JAVAHOME
#Put javahome into enviroment
echo "JAVAHOME=${JAVAHOME}" >> /etc/enviroment
#Sort out tomcat
tar xvfz apache-tomcat-7.0.69.tar.gz -C /usr/local/
echo "CATALINA_HOME=/usr/local/apache-tomcat-7.0.69/" >> /etc/enviroment
#move the war file to tomcat
cp WebGoat-5.4.war /usr/local/apache-tomcat-7.0.69/webapps/WebGoat-5.4.war
# Create the tomcat user
FIND='<tomcat-users>'
REPLACE='<tomcat-users><role rolename="webgoat_admin"\/><user username="webgoat" password="Sec3rt" roles="webgoat_admin"\/>'
sed -i -e "s/$FIND/$REPLACE/g" /usr/local/apache-tomcat-7.0.69/conf/tomcat-users.xml
#Start the service
/usr/local/apache-tomcat-7.0.69/bin/startup.sh
#Done echo the details
echo "url: http://localhost:8080/WebGoat-5.4/attack"
echo "Username: webgoat"
echo "Password: Sec3rt"