# Alternative Dockerfile for local development and customization
# This Dockerfile ensures that local changes are always picked up
# Use this if the standard Dockerfile doesn't pick up your changes

FROM itsafeaturemythic/mythic_python_base:latest

# --- ARGs que Mythic usa al construir payloads (mantenerlos) ---
ARG CA_CERTIFICATE
ARG NPM_REGISTRY
ARG PYPI_INDEX
ARG PYPI_INDEX_URL
ARG DOCKER_REGISTRY_MIRROR
ARG HTTP_PROXY
ARG HTTPS_PROXY

# --- Evita prompts (tzdata) y builds no reproducibles ---
ENV DEBIAN_FRONTEND=noninteractive \
    PIP_NO_CACHE_DIR=1

# --- Instala toolchain y utilidades necesarias para compilar agentes en C ---
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        apt-utils ca-certificates git zip make build-essential \
        libssl-dev zlib1g-dev libbz2-dev xz-utils tk-dev libffi-dev \
        liblzma-dev libsqlite3-dev protobuf-compiler mingw-w64 nasm && \
    rm -rf /var/lib/apt/lists/*

# --- Reconfirma pip y setuptools actualizados (ya viene, pero por si acaso) ---
RUN python -m pip install --upgrade pip setuptools wheel

# --- Instala tus dependencias (sin reinstalar mythic-container) ---
COPY requirements.txt /
RUN pip install --no-cache-dir --no-deps -r /requirements.txt

# --- Variables de entorno necesarias para comunicación con Mythic Core ---
ENV MYTHIC_SERVER_HOST="mythic_server"
ENV MYTHIC_SERVER_PORT="17443"
ENV MYTHIC_SERVER_USERNAME="mythic_admin"
ENV MYTHIC_SERVER_PASSWORD="mythic_password"

# --- Copia tu código de translator de forma explícita ---
# Esto asegura que todos los cambios locales se copien correctamente
WORKDIR /Mythic/

# Copiar estructura completa del proyecto
COPY ./ /Mythic/cazalla/

# Asegurar que los permisos sean correctos para Python
RUN chmod -R a+rX /Mythic/cazalla/

# --- Comando por defecto ---
CMD ["python3", "main.py"]

