diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..cb80dcf --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM tomcat + +COPY . . + +RUN apt-get update ; apt-get install maven default-jdk -y ; update-alternatives --config javac + +RUN mvn clean package ; cp target/*.war /usr/local/tomcat/webapps/ + +CMD ["catalina.sh","run"] diff --git a/README.md b/README.md index 00383e9..b5188c3 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,22 @@ https://www.udemy.com/hacking-securing-java-web-programming/ How to Use/Setup ? ------------- -**Method 1.Very Easiest Method : VirtualBox VM** - The Most easiest way to use Java Vulnerable is using the VirtualBox VM which has everything set up and ready to use. +**Method 1.Super Very Easiest Method: Docker** + The easiest way to use Java Vulnerable is using Docker which set up everything for you with 1 command line + + Steps: + + 1. Install Docker: https://docs.docker.com/engine/installation/ + 2. Install docker-compose: https://docs.docker.com/compose/install/ + 3. Inside this directory, run `sudo docker-compose up` and wait untill everything is configured for you. + 4. In your Browser, go to "http://localhost:8080/JavaVulnerableLab/install.jsp + 5. Change the JDBC URL from jdbc:mysql://localhost:3306 to jdbc:mysql://mysql:3306 + 6. Click the Install Button + 7. Enjoy :) + + +**Method 2.Very Easiest Method : VirtualBox VM** + The second most easiest way to use Java Vulnerable is using the VirtualBox VM which has everything set up and ready to use. Steps: @@ -28,7 +42,7 @@ How to Use/Setup ? 10. Click the Install Button 11. Enjoy :) -**Method 2.Easiest Method : Standalone Web Application** +**Method 3.Easiest Method : Standalone Web Application** In this mehtod, you will be running an executable "JAR" file which runs the application with an embedded Apache Tomcat. Steps: @@ -39,7 +53,7 @@ How to Use/Setup ? 4. In your Browser, go to "http://localhost:8080/JavaVulnerableLab/install.jsp 5. Click the Install Button -**Method 3. Using War file:** +**Method 4. Using War file:** This is a NORMAL method to deploy the WAR file. Steps: diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..672bcac --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,11 @@ +javavulnlab: + build: . + ports: + - 8080:8080 + links: + - mysql + +mysql: + image: mysql + environment: + - MYSQL_ROOT_PASSWORD=root diff --git a/src/main/webapp/WEB-INF/config.properties b/src/main/webapp/WEB-INF/config.properties index 452aa0b..70b612e 100644 --- a/src/main/webapp/WEB-INF/config.properties +++ b/src/main/webapp/WEB-INF/config.properties @@ -5,6 +5,6 @@ dbuser=root dbpass=root dbname=abc -dburl=jdbc:mysql://localhost:3306/ +dburl=jdbc:mysql://mysql:3306/ jdbcdriver=com.mysql.jdbc.Driver -siteTitle=Java Vulnerable Lab \ No newline at end of file +siteTitle=Java Vulnerable Lab diff --git a/src/main/webapp/install.jsp b/src/main/webapp/install.jsp index 1308674..dfbe8f7 100644 --- a/src/main/webapp/install.jsp +++ b/src/main/webapp/install.jsp @@ -10,7 +10,7 @@ Database User: Database Password: JDBC Driver: - JDBC URL: + JDBC URL: Admin Login Credential: Username(Default): Password(Default):