Skip to content

Adding Docker option #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jan 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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:
Expand All @@ -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:
Expand Down
11 changes: 11 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
javavulnlab:
build: .
ports:
- 8080:8080
links:
- mysql

mysql:
image: mysql
environment:
- MYSQL_ROOT_PASSWORD=root
4 changes: 2 additions & 2 deletions src/main/webapp/WEB-INF/config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
siteTitle=Java Vulnerable Lab
2 changes: 1 addition & 1 deletion src/main/webapp/install.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<tr><td>Database User:</td> <td><input type="text" name="dbuser" value="root"/></td></tr>
<tr><td>Database Password:</td> <td><input type="text" name="dbpass" value="root"/></td></tr>
<tr><td>JDBC Driver:</td> <td><input type="text" name="jdbcdriver" value="com.mysql.jdbc.Driver"/></td></tr>
<tr><td>JDBC URL:</td> <td><input type="text" name="dburl" value="jdbc:mysql://localhost:3306/"/></td></tr>
<tr><td>JDBC URL:</td> <td><input type="text" name="dburl" value="jdbc:mysql://mysql:3306/"/></td></tr>
<tr><td>Admin Login Credential:</td></tr>
<tr><td>Username(Default):</td> <td><input type="text" name="adminuser" value="admin"/></td></tr>
<tr><td>Password(Default):</td> <td><input type="text" name="adminpass" value="admin"/></td></tr>
Expand Down