|
1 | | -# ── SecNode API Pentester — Multi-Stage Docker Image ────────────────────────── |
2 | | -# Stage 1: System tool installer |
3 | | -FROM python:3.12-slim AS base |
| 1 | +# ── SecNode API Pentester — Production Docker Image ─────────────────────────── |
| 2 | +# Installs: Nuclei, SQLMap, Dirsearch, Arjun + all Python dependencies |
| 3 | +# ────────────────────────────────────────────────────────────────────────────── |
4 | 4 |
|
| 5 | +FROM python:3.12-slim |
| 6 | + |
| 7 | +# ── Arguments ───────────────────────────────────────────────────────────────── |
5 | 8 | ARG NUCLEI_VERSION=3.3.9 |
6 | 9 |
|
| 10 | +# ── System packages ─────────────────────────────────────────────────────────── |
7 | 11 | RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 12 | + # Core utilities |
8 | 13 | curl wget unzip git ca-certificates \ |
9 | | - # SQLMap dependency |
10 | | - python3 \ |
11 | | - # Dirsearch / Arjun dependencies |
12 | | - python3-pip \ |
| 14 | + # SQLMap needs Python 3 (already present) + these |
| 15 | + python3-dev build-essential \ |
| 16 | + # Network tools |
| 17 | + nmap \ |
| 18 | + # Encoding / parsing deps |
| 19 | + libxml2-dev libxslt1-dev zlib1g-dev \ |
13 | 20 | && rm -rf /var/lib/apt/lists/* |
14 | 21 |
|
15 | | -# ── Install nuclei binary ────────────────────────────────────────────────────── |
16 | | -RUN ARCH=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/') && \ |
17 | | - curl -sSfL \ |
18 | | - "https://github.com/projectdiscovery/nuclei/releases/download/v${NUCLEI_VERSION}/nuclei_${NUCLEI_VERSION}_linux_${ARCH}.zip" \ |
19 | | - -o /tmp/nuclei.zip && \ |
20 | | - unzip -q /tmp/nuclei.zip -d /tmp/nuclei && \ |
21 | | - mv /tmp/nuclei/nuclei /usr/local/bin/nuclei && \ |
22 | | - chmod +x /usr/local/bin/nuclei && \ |
23 | | - rm -rf /tmp/nuclei /tmp/nuclei.zip |
24 | | - |
25 | | -# ── Install Python-based tools ───────────────────────────────────────────────── |
| 22 | +# ── Install Nuclei binary (projectdiscovery) ────────────────────────────────── |
| 23 | +RUN set -eux; \ |
| 24 | + ARCH=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/'); \ |
| 25 | + URL="https://github.com/projectdiscovery/nuclei/releases/download/v${NUCLEI_VERSION}/nuclei_${NUCLEI_VERSION}_linux_${ARCH}.zip"; \ |
| 26 | + curl -sSfL "$URL" -o /tmp/nuclei.zip; \ |
| 27 | + unzip -q /tmp/nuclei.zip -d /tmp/nuclei-bin; \ |
| 28 | + mv /tmp/nuclei-bin/nuclei /usr/local/bin/nuclei; \ |
| 29 | + chmod +x /usr/local/bin/nuclei; \ |
| 30 | + rm -rf /tmp/nuclei-bin /tmp/nuclei.zip; \ |
| 31 | + nuclei -version |
| 32 | + |
| 33 | +# ── Install Python pentesting tools ─────────────────────────────────────────── |
26 | 34 | RUN pip install --no-cache-dir \ |
| 35 | + # SQL injection scanner |
27 | 36 | sqlmap \ |
| 37 | + # Directory / endpoint brute-forcer |
28 | 38 | dirsearch \ |
29 | | - arjun |
| 39 | + # HTTP parameter discovery |
| 40 | + arjun \ |
| 41 | + # Extra HTTP client used by several tools |
| 42 | + requests \ |
| 43 | + urllib3 |
30 | 44 |
|
31 | | -# Stage 2: Application image |
32 | | -FROM base AS app |
| 45 | +# ── Pull Nuclei templates (cached as a layer) ───────────────────────────────── |
| 46 | +RUN nuclei -update-templates -silent || true |
33 | 47 |
|
| 48 | +# ── Application setup ───────────────────────────────────────────────────────── |
34 | 49 | WORKDIR /app |
35 | 50 |
|
36 | | -# Install the SecNode project with all Python dependencies |
| 51 | +# Copy dependency manifests first for better layer caching |
37 | 52 | COPY pyproject.toml ./ |
| 53 | + |
| 54 | +# Copy source |
38 | 55 | COPY src/ ./src/ |
39 | | -RUN pip install --no-cache-dir -e ".[dev]" |
40 | 56 |
|
41 | | -# Pull Nuclei templates on first run (cached after) |
42 | | -RUN nuclei -update-templates -silent || true |
| 57 | +# Install SecNode + all its Python dependencies |
| 58 | +RUN pip install --no-cache-dir -e "." \ |
| 59 | + && pip install --no-cache-dir \ |
| 60 | + httpx==0.27.0 \ |
| 61 | + pydantic==2.6.3 \ |
| 62 | + structlog==24.1.0 \ |
| 63 | + litellm==1.34.0 \ |
| 64 | + PyYAML==6.0.1 \ |
| 65 | + rich \ |
| 66 | + asyncio \ |
| 67 | + aiofiles |
43 | 68 |
|
44 | | -# ── Runtime config ───────────────────────────────────────────────────────────── |
45 | | -# Environment variables expected at runtime: |
46 | | -# NEBIUS_API_KEY — Nebius LLM API key |
47 | | -# NEBIUS_API_BASE — Nebius API base URL |
48 | | -# SECNODE_LLM — LiteLLM model string (e.g. nebius/deepseek-ai/DeepSeek-V3.2) |
49 | | -# OPENAI_API_KEY — (optional) OpenAI API key |
| 69 | +# Verify all tools are accessible |
| 70 | +RUN nuclei -version && \ |
| 71 | + sqlmap --version && \ |
| 72 | + dirsearch --version || true && \ |
| 73 | + arjun --help | head -3 || true |
50 | 74 |
|
| 75 | +# ── Volumes & Runtime config ─────────────────────────────────────────────────── |
| 76 | +# Results are written to /app/results — mount this for persistence |
51 | 77 | VOLUME ["/app/results"] |
52 | 78 |
|
| 79 | +# ── Environment variables (set at runtime via -e or .env) ───────────────────── |
| 80 | +# NEBIUS_API_KEY — Nebius LLM API key |
| 81 | +# NEBIUS_API_BASE — Nebius API endpoint |
| 82 | +# SECNODE_LLM — e.g. nebius/deepseek-ai/DeepSeek-V3.2 |
| 83 | +# OPENAI_API_KEY — (optional) for OpenAI models |
| 84 | + |
53 | 85 | ENTRYPOINT ["secnodeapi"] |
54 | 86 | CMD ["--help"] |
0 commit comments