content: # TEMPLATE DESCRIPTION: Kali Linux (Heavy, Penetration testing and security tools)
  FROM kalilinux/kali-rolling:latest
  ARG HOST_UID=1000
  ARG HOST_GID=1000
  
  ENV VIRTUAL_ENV=/opt/venv PATH="/opt/venv/bin:$PATH"
  
  # Turn off interactive requests
  ENV DEBIAN_FRONTEND=noninteractive
  
  # Update and install essential packages
  RUN apt-get update && apt-get install -y \
      kali-linux-headless \
      curl \
      wget \
      git \
      vim \
      nano \
      htop \
      tree \
      jq \
      unzip \
      zip \
      sudo \
      build-essential \
      software-properties-common \
      ca-certificates \
      gnupg \
      && rm -rf /var/lib/apt/lists/*
  
  # Install popular penetration testing tools
  RUN apt-get update && apt-get install -y \
      nmap \
      masscan \
      nikto \
      dirb \
      gobuster \
      sqlmap \
      john \
      hashcat \
      hydra \
      aircrack-ng \
      metasploit-framework \
      burpsuite \
      wireshark \
      tcpdump \
      netcat-traditional \
      socat \
      ncat \
      && rm -rf /var/lib/apt/lists/*
  
  # Install web security tools
  RUN apt-get update && apt-get install -y \
      whatweb \
      wpscan \
      ffuf \
      wfuzz \
      sublist3r \
      amass \
      subfinder \
      assetfinder \
      && rm -rf /var/lib/apt/lists/*
  
  # Install network tools
  RUN apt-get update && apt-get install -y \
      dnsutils \
      whois \
      traceroute \
      telnet \
      ssh \
      sshpass \
      proxychains4 \
      tor \
      && rm -rf /var/lib/apt/lists/*
  
  # Install Python 3 and common security libraries
  RUN apt-get update && apt-get install -y \
      python3 \
      python3-pip \
      python3-venv \
      python3-dev \
      && python3 -m venv /opt/venv \
      && /opt/venv/bin/pip install --upgrade pip \
      && /opt/venv/bin/pip install \
      requests \
      beautifulsoup4 \
      scapy \
      pwntools \
      impacket \
      netaddr \
      dnspython \
      paramiko \
      && rm -rf /var/lib/apt/lists/*
  
  # Install additional useful tools
  RUN apt-get update && apt-get install -y \
      wordlists \
      seclists \
      dirbuster \
      && rm -rf /var/lib/apt/lists/*
  
  # Create a group and user with sudo access
  RUN groupadd -g ${HOST_GID} sandbox-group 2>/dev/null || true
  RUN useradd -u ${HOST_UID} -g ${HOST_GID} -m -s /bin/bash sandbox-user \
      && echo "sandbox-user:kali123" | chpasswd \
      && usermod -aG sudo sandbox-user \
      && echo "sandbox-user ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \
      && echo "Defaults !requiretty" >> /etc/sudoers
  
  # User workspace
  USER sandbox-user
  WORKDIR /home/sandbox-user
  
  # Create .bashrc with useful aliases
  RUN echo 'export PATH="$PATH:/usr/share/metasploit-framework"' >> ~/.bashrc \
      && echo 'alias ll="ls -la"' >> ~/.bashrc \
      && echo 'alias la="ls -A"' >> ~/.bashrc \
      && echo 'alias l="ls -CF"' >> ~/.bashrc \
      && echo 'alias ..="cd .."' >> ~/.bashrc \
      && echo 'alias ...="cd ../.."' >> ~/.bashrc \
      && echo 'alias tree="tree -C"' >> ~/.bashrc \
      && echo 'alias nse="ls /usr/share/nmap/scripts/ | grep"' >> ~/.bashrc \
      && echo 'alias wordlists="ls /usr/share/wordlists/"' >> ~/.bashrc \
      && echo 'alias rockyou="gunzip -c /usr/share/wordlists/rockyou.txt.gz"' >> ~/.bashrc
  
  # Welcome message with security tools info
  RUN echo 'echo "🔴 Welcome to Kali Linux Pentest Sandbox! 🔴"' >> ~/.bashrc \
      && echo 'echo "Available tools: nmap, sqlmap, metasploit, burpsuite, hydra, john"' >> ~/.bashrc \
      && echo 'echo "Web tools: nikto, dirb, gobuster, ffuf, wpscan"' >> ~/.bashrc \
      && echo 'echo "Network: wireshark, tcpdump, netcat, proxychains"' >> ~/.bashrc \
      && echo 'echo "Wordlists: /usr/share/wordlists/ (rockyou, seclists)"' >> ~/.bashrc \
      && echo 'echo "⚠️  Use only for authorized testing! ⚠️"' >> ~/.bashrc \
      && echo 'echo "Current user: $(whoami) (UID: $(id -u), GID: $(id -g))"' >> ~/.bashrc \
      && echo 'echo "Try: nmap --version, msfconsole, hydra -h"' >> ~/.bashrc \
      && echo 'cd /home/sandbox-user 2>/dev/null || true' >> ~/.bashrc
  
  # Set proper permissions for Metasploit
  USER root
  RUN mkdir -p /home/sandbox-user/.msf4 \
      && chown -R sandbox-user:sandbox-group /home/sandbox-user/.msf4
  
  # Switch back to sandbox user
  USER sandbox-user
  
  # Force home directory
  ENV HOME=/home/sandbox-user
  WORKDIR /home/sandbox-user
  
  CMD ["bash"]
  