Autonomous OODA-loop pentesting agent. Hermes brain, Kali + Playwright tools over MCP, ATT&CK as the Orient language.
Python ai-agentsautonomous-agentskali-linuxllm-agentsoffensive-securityooda-looppentestingplaywrightsecurity
feat: curated Kali CLIs, Juice Shop lab docs, Ollama model warning (v1.2.0)
irrazf6cc4abb9cd3
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 2a92aaf..d135e26 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -5,6 +5,27 @@ All notable changes to Vulnerator AI are documented here.The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).+## [1.2.0] - 2026-10-16++### Added+- **Curated pentest CLIs baked into the Kali image.** The Kali `Dockerfile` now pre-installs a+ small, deliberate set the skills assume exist and invoke via `kali_run`: `nmap`, `whatweb`,+ `nuclei`, `ffuf`, `sqlmap`, `gobuster`, plus `impacket-scripts` and `bloodhound.py`. The base+ `kalilinux/kali-rolling` image ships none of these, so this fixes a latent runtime gap while+ keeping the image reasonably sized (curated, not the full `kali-linux-headless` metapackage).+- **Documented Juice Shop lab quickstart.** New README subsection documenting how to bring the+ stack up together with `docker-compose.target.yml` (OWASP Juice Shop) and point an engagement+ at `http://juice-shop:3000` — a deliberately-vulnerable web target on the internal network (not+ exposed to the host) for practicing the `web-pentest` skill.++### Changed+- The Ollama startup branch now **warns** (non-fatal, to stderr) when `OLLAMA_BASE_URL` is set but+ `OLLAMA_MODEL` is empty, since the profile default model name would otherwise be used against the+ Ollama endpoint (which almost certainly does not serve it). Behavior is otherwise unchanged.+- Added a regression test for the OpenRouter-vs-Ollama provider-selection startup logic in+ `docker-compose.yml`, protecting the optional `${...:-}` env form, the fail-closed OpenRouter+ guard and the new empty-`OLLAMA_MODEL` warning against silent regressions.+## [1.1.0] - 2026-10-16### Added@@ -38,5 +59,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0the authorized-offensive pentest framing; overriding with such a model may make the agentrefuse to work.+[1.2.0]: https://github.com/irraz/vulnerator-ai/releases/tag/v1.2.0[1.1.0]: https://github.com/irraz/vulnerator-ai/releases/tag/v1.1.0[1.0.1]: https://github.com/irraz/vulnerator-ai/releases/tag/v1.0.1diff --git a/README.md b/README.mdindex 64264a9..f0c6f65 100644--- a/README.md+++ b/README.md@@ -65,6 +65,30 @@ Three containers (the agent and two MCP servers) and the agent driving end to enThere are no `api` or `ui` services: the agent talks directly to the MCPs (Kali and browser).+### Tools included in the Kali image++The Kali image bakes in a **curated** set of pentest CLIs the skills assume exist and invoke via+`kali_run` (the base `kalilinux/kali-rolling` image is minimal and ships none of them). This is a+deliberate, small selection — **not** the full `kali-linux-headless` metapackage — to keep the+image reasonably sized:++| Baked-in tool | Used for |+| --- | --- |+| `nmap` | network/port/service enumeration |+| `whatweb` | web tech fingerprinting |+| `nuclei` | templated vulnerability scanning |+| `ffuf` | web fuzzing |+| `sqlmap` | SQL injection testing |+| `gobuster` | directory/DNS/vhost brute forcing |+| `impacket-scripts` | Impacket CLI helpers (AD/network) — invoked with the `impacket-` prefix, e.g. `impacket-secretsdump`, `impacket-GetUserSPNs` |+| `bloodhound.py` | BloodHound Python ingestor (AD) — command `bloodhound-python` |++Plus the cloud-collection tooling in the Python venv (Prowler, ScoutSuite, Cloudsplaining, Pacu).+Anything else a specific engagement needs can still be `apt install`-ed on the fly inside the+`kali` container; note it lives in the container's ephemeral layer and disappears on the next+`down`/`up` (bake it into the `Dockerfile` to make it permanent — see "Start clean between+exercises").+## How to bring it up**All keys and credentials go in a `.env` file** at the repo root. It is not@@ -148,6 +172,35 @@ Hermes' API server on `:8642`. That API server is an **alternative programmatic*(OpenAI-compatible) and is **published to the host** by default, to pilot Hermes from anexternal assistant without entering the TUI (see the next section).+### Quickstart against a lab target (Juice Shop)++To practice the `web-pentest` skill without going out to the internet or touching real systems,+the repo ships an **optional** target override, `docker-compose.target.yml`, that adds an+[OWASP Juice Shop](https://owasp.org/www-project-juice-shop/) service. Juice Shop is a+**deliberately-vulnerable** web application (OWASP project), the de facto standard for practicing+web pentesting (XSS, SQLi, broken auth, etc.).++Bring the whole stack up **with** the target by layering both compose files:++```sh+docker compose -f docker-compose.yml -f docker-compose.target.yml up -d --build+```++The target joins the **same internal docker network** and publishes **no port to the host**, so it+only exists inside the docker environment — scoping the exercise to a controlled lab. Hermes/Kali+reach it by its DNS name at **`http://juice-shop:3000`**. Point an engagement at that URL, e.g. via+the interactive TUI:++```sh+docker compose -f docker-compose.yml -f docker-compose.target.yml exec -it ooda-agent hermes chat+# then ask, in natural language:+# "Authorized web pentest against http://juice-shop:3000 (scope: that host only).+# Enumerate, fingerprint, and test for injection/auth flaws. Report confirmed findings."+```++This is the authorized target for practicing the `web-pentest` skill. Only the web lab is in scope+here (no AD or other labs for now).+## Pilot Hermes from an external assistant (Kiro / Claude)Sometimes you don't want to enter the `hermes chat` TUI: you want an assistant (Kiro, Claude, adiff --git a/VERSION b/VERSIONindex 9084fa2..26aaba0 100644--- a/VERSION+++ b/VERSION@@ -1 +1 @@-1.1.0+1.2.0diff --git a/agent-ooda/tests/test_provider_selection.py b/agent-ooda/tests/test_provider_selection.pynew file mode 100644index 0000000..179601b--- /dev/null+++ b/agent-ooda/tests/test_provider_selection.py@@ -0,0 +1,80 @@+"""Tests de regresion de la SELECCION DE PROVEEDOR LLM en el arranque del compose.++El servicio ooda-agent elige proveedor en su script de arranque (`sh -c`): por defecto OpenRouter+(fail-closed si falta la key) y, de forma opt-in, Ollama cuando OLLAMA_BASE_URL esta puesta. Esta+logica es config declarativa en docker-compose.yml (variables de entorno + el `command`), no codigo+Python del repo; estos tests afirman su CONTRATO parseando el compose para que no regrese en silencio.++Protegen:+ - OLLAMA_BASE_URL / OLLAMA_MODEL declaradas como OPCIONALES (forma ${...:-}) y OPENROUTER_API_KEY+ ya NO en la forma fail-closed `:?` a nivel compose.+ - el script ramifica en OLLAMA_BASE_URL (rama Ollama => model.provider / model.base_url) y la rama+ OpenRouter re-crea un guard fail-closed que sale != 0 si OPENROUTER_API_KEY esta vacia.+ - el aviso D1 cuando OLLAMA_MODEL esta vacio en modo Ollama.+"""++from __future__ import annotations++from pathlib import Path++import yaml+++def _load_ooda_agent(compose_path: Path) -> dict:+ compose = yaml.safe_load(compose_path.read_text(encoding="utf-8"))+ return compose["services"]["ooda-agent"]+++def _startup_script(compose_path: Path) -> str:+ command = _load_ooda_agent(compose_path)["command"]+ return command[-1] if isinstance(command, list) else str(command)+++# --- Entorno: proveedores opcionales, OpenRouter ya no fail-closed en compose ---+++def test_ollama_env_vars_declared_optional(compose_path: Path) -> None:+ # Las variables de Ollama se declaran OPCIONALES (forma ${VAR:-}), nunca fail-closed.+ env = _load_ooda_agent(compose_path)["environment"]+ assert env["OLLAMA_BASE_URL"] == "${OLLAMA_BASE_URL:-}"+ assert env["OLLAMA_MODEL"] == "${OLLAMA_MODEL:-}"+++def test_openrouter_api_key_not_fail_closed_in_compose(compose_path: Path) -> None:+ # OPENROUTER_API_KEY ya NO usa la forma fail-closed `:?` a nivel compose (para que el modo+ # Ollama pueda arrancar sin key). El default `:-` deja el guard fail-closed al script.+ env = _load_ooda_agent(compose_path)["environment"]+ assert env["OPENROUTER_API_KEY"] == "${OPENROUTER_API_KEY:-}"+ assert ":?" not in env["OPENROUTER_API_KEY"], "OPENROUTER_API_KEY no debe ser fail-closed en compose"+++# --- Script de arranque: ramificacion de proveedor ---+++def test_startup_branches_on_ollama_base_url(compose_path: Path) -> None:+ # Ramifica en OLLAMA_BASE_URL ($$ es el escape del compose para $ en el shell del contenedor).+ script = _startup_script(compose_path)+ assert 'if [ -n "$$OLLAMA_BASE_URL" ]; then' in script+++def test_ollama_branch_sets_provider_and_base_url(compose_path: Path) -> None:+ # La rama Ollama apunta Hermes al endpoint OpenAI-compatible (provider custom + base_url).+ script = _startup_script(compose_path)+ assert "hermes config set model.provider custom" in script+ assert 'hermes config set model.base_url "$$OLLAMA_BASE_URL"' in script+++def test_openrouter_branch_is_fail_closed(compose_path: Path) -> None:+ # La rama OpenRouter re-crea el guard fail-closed: key vacia => aborta con salida != 0.+ script = _startup_script(compose_path)+ assert 'if [ -z "$$OPENROUTER_API_KEY" ]; then' in script+ assert "exit 1" in script+++def test_empty_ollama_model_warning_present(compose_path: Path) -> None:+ # Aviso D1: OLLAMA_BASE_URL puesta pero OLLAMA_MODEL vacia => warning NO fatal a stderr.+ script = _startup_script(compose_path)+ assert "OLLAMA_MODEL" in script+ # El aviso va a stderr (>&2) y NO aborta (no exit en esa rama).+ assert ">&2" in script+ assert "WARNING" in scriptdiff --git a/docker-compose.yml b/docker-compose.ymlindex 9a7ebc5..82b5828 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -103,6 +103,12 @@ services:# though for Ollama you normally want an Ollama-served model name here).if [ -n "$$OLLAMA_MODEL" ]; thenhermes config set model.default "$$OLLAMA_MODEL" >/dev/null+ else+ # D1 warning (non-fatal): no OLLAMA_MODEL set, so the profile default model NAME+ # (mistralai/mistral-large-4-0) is now pointed at the Ollama endpoint, which almost+ # certainly does NOT serve a model by that name. Warn but DO NOT abort: the operator+ # most likely wants to set OLLAMA_MODEL to an Ollama-served model name.+ echo "WARNING: OLLAMA_BASE_URL is set but OLLAMA_MODEL is empty. The profile default model name (mistralai/mistral-large-4-0) will be used against the Ollama endpoint, which probably does not serve it. Set OLLAMA_MODEL to an Ollama-served model name (e.g. qwen2.5-coder:32b)." >&2fielse# --- OpenRouter mode (default, OLLAMA_BASE_URL empty) ------------------diff --git a/docker/kali/Dockerfile b/docker/kali/Dockerfileindex 2811562..4541605 100644--- a/docker/kali/Dockerfile+++ b/docker/kali/Dockerfile@@ -49,6 +49,29 @@ RUN apt-get update \git \&& rm -rf /var/lib/apt/lists/*+# CURATED set of pentest CLIs that the skills (web-pentest, recon) assume exist and invoke via+# kali_run. The base kalilinux/kali-rolling image is MINIMAL and ships NONE of these, so without+# this layer those skills would fail at runtime. We bake a SMALL, deliberate selection (NOT the+# kali-linux-headless metapackage) to fix that latent gap while keeping the image reasonably sized:+# - nmap, whatweb, nuclei, ffuf, sqlmap, gobuster : web/recon tools used by the skills.+# - impacket-scripts : Impacket CLI helpers (AD/network).+# - bloodhound.py : BloodHound Python ingestor (AD).+# All package names were confirmed installable in kali-rolling (apt-get install --dry-run). Own+# RUN layer with --no-install-recommends + rm -rf /var/lib/apt/lists/*, consistent with the style+# above. Tools NOT baked here (anything else a skill needs ad-hoc) are still `apt install`-able on+# the fly inside the ephemeral kali container.+RUN apt-get update \+ && apt-get install -y --no-install-recommends \+ nmap \+ whatweb \+ nuclei \+ ffuf \+ sqlmap \+ gobuster \+ impacket-scripts \+ bloodhound.py \+ && rm -rf /var/lib/apt/lists/*+WORKDIR /opt/kali-mcp# Virtualenv dedicado con Python 3.13 (compatible con Prowler). Ponerlo primero en