Skip to content

A Dockerized Kali Linux environment for penetration testing with GUI support, host networking, and persistent storage – perfect for security assessments and CTFs.

License

Notifications You must be signed in to change notification settings

lpolish/kali-pentest-container

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kali Linux Docker Setup for Wireless Testing

This Docker setup provides a Kali Linux environment optimized for wireless testing and packet capture, with automatic monitor mode activation and USB Wi-Fi card support.

Features

  • USB Wi-Fi card passthrough
  • Host networking mode
  • Automatic monitor mode activation
  • Preinstalled wireless tools (airodump-ng, iwconfig, tcpdump)
  • Common error handling (RTNETLINK errors, rfkill blocks, driver issues)
  • Persistent capture storage
  • Interactive container management
  • X11 forwarding support
  • Full Kali Linux toolset (kali-linux-default)
  • GUI application support (Burp Suite, etc.)
  • Pre-installed tools: PEASS, PayloadsAllTheThings

Prerequisites

  • Docker and Docker Compose installed
  • Linux host system (Ubuntu/Debian recommended)
  • USB Wi-Fi card compatible with monitor mode
  • Root/sudo access
  • X11 server running (for GUI apps)
    • Linux: Already configured
    • Mac: Install XQuartz
    • Windows: Install VcXsrv
  • At least 4GB RAM recommended
  • 20GB free disk space

Why Docker?

This setup uses Docker to provide a secure, isolated environment for penetration testing and wireless security research. Here's how it protects your host system:

  • Isolation: All testing activities are contained within the Docker container, preventing accidental modifications to your host system
  • Resource Control: Docker's resource limits prevent any single container from consuming all system resources
  • Clean Environment: Each container starts with a fresh, known-good state, eliminating conflicts with existing tools or configurations
  • Easy Cleanup: Simply removing the container eliminates all testing artifacts and potential malware
  • Version Control: Docker images can be versioned and rolled back if needed
  • Reproducibility: The same environment can be recreated on any system with Docker installed
  • Network Isolation: While we use host networking for wireless testing, other network interfaces remain isolated
  • File System Protection: The container's file system is isolated from the host, preventing accidental file system corruption

Quick Start

  1. Clone this repository:

    git clone https://github.com/lpolish/kali-pentest-container.git
    cd kali-pentest-container
  2. Build the Docker image:

    docker compose build
  3. Start the container using the management script:

    ./start.sh
  4. From the menu, select:

    • Option 3 for wireless testing
    • Option 1 for general pentesting
    • Option 8 to attach to a running container

Scripts

start.sh

The main management script that provides:

  • Interactive menu for container management
  • Container lifecycle control (start/stop/rebuild)
  • X11 forwarding setup
  • Persistent storage management
  • Container status monitoring
  • Easy container attachment

start_monitor.sh

A specialized script for wireless testing that:

  • Automatically configures wireless interfaces
  • Handles monitor mode activation
  • Manages driver issues
  • Provides wireless-specific error handling
  • Runs automatically when the wireless container starts

Usage

Once inside the container, you can use the following commands:

  • List wireless interfaces:

    iwconfig
  • Start packet capture:

    airodump-ng wlan0
  • Capture packets to file:

    tcpdump -i wlan0 -w /root/captures/capture.pcap
  • Run GUI apps from container shell:

    burp     # Burp Suite
    firefox  # Firefox browser
    wireshark # Network analysis
  • Use tmux for session management:

    tmux     # Start new session
    tmux a   # Attach to existing session

Troubleshooting

USB Device Not Found

  1. Check if the device is recognized by the host:

    lsusb
  2. Verify USB passthrough:

    docker exec -it kali-wifi lsusb

Monitor Mode Issues

  1. Check interface status:

    iwconfig
  2. Manually reload driver:

    modprobe -r <driver>
    modprobe <driver>

RTNETLINK Errors

  1. Check for conflicting processes:

    airmon-ng check
  2. Kill conflicting processes:

    airmon-ng check kill

GUI Apps Not Displaying

  1. Ensure X11 server is running
  2. Run on Linux/Mac:
    xhost +local:root
  3. Check environment variables:
    echo $DISPLAY
    echo $XAUTHORITY

Network Tools Not Working

  1. Verify host networking mode is active
  2. Check host firewall rules
  3. Ensure Docker has necessary permissions

Performance Issues

  1. Increase Docker resource limits
  2. Check host system resources
  3. Consider using volume mounts for large datasets

Directory Structure

  • Dockerfile: Container configuration
  • docker-compose.yml: Docker Compose configuration
  • start.sh: Main container management script
  • start_monitor.sh: Wireless interface setup script
  • captures/: Directory for packet captures
  • pentest/: Directory for persistent pentesting data

Security Notes

  • This container runs in privileged mode and uses host networking
  • Use only on systems you own or have permission to test
  • Follow all applicable laws and regulations
  • Keep the system updated and secure
  • Destroy container after use to wipe temporary data
  • No sensitive data stored in container
  • Regular security updates via apt

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A Dockerized Kali Linux environment for penetration testing with GUI support, host networking, and persistent storage – perfect for security assessments and CTFs.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published