42 lines
937 B
Docker
42 lines
937 B
Docker
FROM python:3.11-slim
|
|
|
|
# Install system dependencies and masscan
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends \
|
|
git \
|
|
build-essential \
|
|
libpcap-dev \
|
|
nmap \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Build and install masscan from source
|
|
RUN git clone https://github.com/robertdavidgraham/masscan /tmp/masscan && \
|
|
cd /tmp/masscan && \
|
|
make && \
|
|
make install && \
|
|
cd / && \
|
|
rm -rf /tmp/masscan
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy requirements and install Python dependencies
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy application code
|
|
COPY src/ ./src/
|
|
|
|
# Create output directory
|
|
RUN mkdir -p /app/output
|
|
|
|
# Make scanner executable
|
|
RUN chmod +x /app/src/scanner.py
|
|
|
|
# Force Python unbuffered output
|
|
ENV PYTHONUNBUFFERED=1
|
|
|
|
# Set entry point with unbuffered Python
|
|
ENTRYPOINT ["python3", "-u", "/app/src/scanner.py"]
|
|
CMD ["--help"]
|