This repository contains configuration files and scripts to set up a Dockerized environment for testing and learning about vulnerabilities using Kali Linux and other related tools. Below is the detailed explanation and usage guide for each component of this repository.
- Compose File
- Batch Script (Windows)
- Bash Script (Linux/Mac)
- Usage Instructions
- Components Overview
- Network Configuration
The docker-compose.yml
file defines the services to set up a hacking lab environment. It includes:
-
kali-linux-c:
- Based on the
kalilinux/kali-rolling
image. - Fixed IP:
172.20.2.5
(internal network). - Connected to both
hacking-lab-ex
(external network for internet access) andhacking-lab-in
(internal network for communication). - Configured to restart automatically unless stopped manually.
- Based on the
-
kali-linux-vc:
- Based on
lscr.io/linuxserver/kali-linux
. - Supports custom environment variables for user and group IDs (
PUID
andPGID
), timezone, and title. - Fixed IP:
172.20.2.10
(internal network). - Connected to both
hacking-lab-ex
(external network for internet access) andhacking-lab-in
(internal network for communication). - Optional GPU connection for Linux hosts.
- Ports:
3000
and3001
.
- Based on
-
vulnerable-dvwac:
- Deploys the
vulnerables/web-dvwa
image. - Fixed IP:
172.20.2.3
(internal network). - Connected only to
hacking-lab-in
(internal network for communication). - Configured to restart automatically unless stopped manually.
- Deploys the
-
hacking-lab-ex:
- External network for internet access.
- Subnet:
172.20.1.0/24
. - Not marked as internal, allowing internet access for connected containers.
-
hacking-lab-in:
- Internal network for communication between containers.
- Subnet:
172.20.2.0/24
. - Marked as
internal: true
, preventing internet access for connected containers.
The setup.bat
script simplifies container creation for Windows users.
- Prompts for:
PUID
andPGID
- Custom title
- Ports
- Shared memory size (
shm-size
) - Restart policy
- Automatically runs the Docker container with the provided inputs.
- Run the script by double-clicking or from the terminal.
- Follow the prompts to configure the container.
- The container will be created and started with the specified settings.
The setup.sh
script simplifies container creation for Linux/Mac users.
- Interactive prompts for:
PUID
andPGID
- Custom title
- Ports
- Shared memory size (
shm-size
) - Restart policy
- Automatically constructs and runs the Docker container.
- Make the script executable:
chmod +x setup.sh
- Run the script:
./setup.sh
- Follow the prompts to configure the container.
- The container will be created and started with the specified settings.
-
Clone this repository:
git clone https://github.com/RashmithaDeSilva/HackLab.git cd HackLab
- Before using, set your PC ID in the Compose File (you can get it using the
id
command in the terminal) and replace it with thePUID
andPGID
values in the compose file. Also, if you need more access to work, comment out thesecurity_opt
section in the compose file. If you are using Windows, comment out thedevice
section in the compose file.
- Before using, set your PC ID in the Compose File (you can get it using the
-
Using Docker Compose:
- Start all services:
docker compose up -d
- Stop all services:
docker compose down --volumes
- Stop all services with imagers:
docker compose down --volumes --rmi all
-
Using Scripts:
- On Windows, run
setup.bat
. - On Linux/Mac, run
setup.sh
.
- On Windows, run
-
Access the services via their respective ports (e.g.,
http://localhost:3000
forkali-linux-vc
). -
Access the
vulnerable-dvwac
container by navigating tohttp://172.20.2.3:80
in thekali-linux-vc
browser. The default username isadmin
, and the password ispassword
.
- A lightweight Kali Linux container for terminal-based tasks.
- Can access the internet and communicate with other containers.
- A more feature-rich Kali Linux container with optional GPU support and web-based tools.
- Can access the internet and communicate with other containers.
- Deploys Damn Vulnerable Web Application (DVWA) for practicing vulnerability testing.
- Cannot access the internet but can communicate with other containers.
-
hacking-lab-ex:
- Provides internet access to connected containers (
kali-linux-c
andkali-linux-vc
). - Subnet:
172.20.1.0/24
.
- Provides internet access to connected containers (
-
hacking-lab-in:
- Internal network for communication between all containers.
- Subnet:
172.20.2.0/24
. - Marked as
internal: true
, preventing internet access for connected containers.
The docker-compose.yml
file defines two networks:
-
hacking-lab-ex:
- External network for internet access.
- Subnet:
172.20.1.0/24
.
-
hacking-lab-in:
- Internal network for communication between containers.
- Subnet:
172.20.2.0/24
. - Marked as
internal: true
to restrict internet access.
- Ensure Docker and Docker Compose are installed on your system.
- Update environment variables as needed in the scripts or compose file.
- This setup is designed for educational purposes and should not be used in production environments without proper security measures.
Happy hacking!