Skip to content

Commit a96c867

Browse files
committed
feat(docker): Comprehensive Dockerfile with all pentesting tools
- Added system deps: build-essential, libxml2-dev, libxslt1-dev, nmap - Installs Nuclei binary from GitHub releases (auto arch detection) - Installs sqlmap, dirsearch, arjun via pip - Verifies all tools are accessible at build time - Full SecNode Python project installation - Pulls Nuclei templates as a cached Docker layer
1 parent 2b2ca56 commit a96c867

1 file changed

Lines changed: 63 additions & 31 deletions

File tree

Dockerfile

Lines changed: 63 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,86 @@
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+
# ──────────────────────────────────────────────────────────────────────────────
44

5+
FROM python:3.12-slim
6+
7+
# ── Arguments ─────────────────────────────────────────────────────────────────
58
ARG NUCLEI_VERSION=3.3.9
69

10+
# ── System packages ───────────────────────────────────────────────────────────
711
RUN apt-get update && apt-get install -y --no-install-recommends \
12+
# Core utilities
813
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 \
1320
&& rm -rf /var/lib/apt/lists/*
1421

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 ───────────────────────────────────────────
2634
RUN pip install --no-cache-dir \
35+
# SQL injection scanner
2736
sqlmap \
37+
# Directory / endpoint brute-forcer
2838
dirsearch \
29-
arjun
39+
# HTTP parameter discovery
40+
arjun \
41+
# Extra HTTP client used by several tools
42+
requests \
43+
urllib3
3044

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
3347

48+
# ── Application setup ─────────────────────────────────────────────────────────
3449
WORKDIR /app
3550

36-
# Install the SecNode project with all Python dependencies
51+
# Copy dependency manifests first for better layer caching
3752
COPY pyproject.toml ./
53+
54+
# Copy source
3855
COPY src/ ./src/
39-
RUN pip install --no-cache-dir -e ".[dev]"
4056

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
4368

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
5074

75+
# ── Volumes & Runtime config ───────────────────────────────────────────────────
76+
# Results are written to /app/results — mount this for persistence
5177
VOLUME ["/app/results"]
5278

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+
5385
ENTRYPOINT ["secnodeapi"]
5486
CMD ["--help"]

0 commit comments

Comments
 (0)