# Use Kali Linux as base image FROM kalilinux/kali-rolling # Set environment variables ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 ENV DEBIAN_FRONTEND=noninteractive ENV TERM=xterm-256color # Set working directory WORKDIR /app # Copy the local directory's contents into the container at /app COPY ./ /app/ # Update and install necessary packages RUN apt-get update && \ apt-get install -y \ python3 \ python3-pip \ curl \ wget \ gnupg2 \ lsb-release \ nano \ apktool \ sudo \ netcat-traditional \ virtualbox \ virtualbox-dkms \ linux-headers-amd64 \ && apt-get clean # Install Python dependencies (assuming requirements.txt is in the same directory) COPY requirements.txt /app/requirements.txt RUN pip install --no-cache-dir -r /app/requirements.txt # Create a new user RUN useradd -r -u 1000 -m -s /bin/bash appuser && \ chown -R appuser:appuser /app # Grant execute permissions to all files in the /app directory RUN chmod +x /app/* # Modify sudoers file to allow passwordless sudo RUN echo "appuser ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/appuser && \ chmod 0440 /etc/sudoers.d/appuser # Switch to the new user USER appuser # Run pyxtermjs when the container starts CMD ["python3", "-m", "pyxtermjs", "--host", "0.0.0.0", "-p", "7860"]