Metadata-Version: 2.4
Name: enigmatic-red
Version: 0.1.0
Summary: Research-lab beta: a non-destructive vulnerability assessment agent across Infrastructure, Web App, Cloud and AI security that proves what it did.
Author: Enigmatic Red
License-Expression: LicenseRef-Proprietary
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx>=0.28
Requires-Dist: pydantic>=2.12
Requires-Dist: pydantic-settings>=2.10
Requires-Dist: PyYAML>=6.0
Provides-Extra: serve
Requires-Dist: fastapi>=0.128; extra == "serve"
Requires-Dist: uvicorn[standard]>=0.40; extra == "serve"
Requires-Dist: starlette>=0.52; extra == "serve"
Requires-Dist: websockets>=15; extra == "serve"
Requires-Dist: reportlab>=4.0; extra == "serve"
Provides-Extra: desktop
Requires-Dist: fastapi>=0.128; extra == "desktop"
Requires-Dist: uvicorn[standard]>=0.40; extra == "desktop"
Requires-Dist: starlette>=0.52; extra == "desktop"
Requires-Dist: websockets>=15; extra == "desktop"
Requires-Dist: pywebview>=5.4; platform_system == "Windows" and extra == "desktop"
Requires-Dist: reportlab>=4.0; extra == "desktop"
Provides-Extra: persistence
Requires-Dist: SQLAlchemy<2.0,>=1.4.54; extra == "persistence"
Requires-Dist: alembic>=1.13; extra == "persistence"
Provides-Extra: reporting
Requires-Dist: reportlab>=4.0; extra == "reporting"
Provides-Extra: dev
Requires-Dist: pytest>=9.0; extra == "dev"
Dynamic: license-file

# Enigmatic Red

Enigmatic Red is a scope-locked, non-destructive vulnerability assessment agent:
it plans a scan, runs only capabilities it has registered, and proves afterwards
what it did. It is the assessment half of a penetration test, done automatically —
reconnaissance, enumeration and verified proof — and deliberately not the other
half: no exploitation, no escalation, no lateral movement, no impact
demonstration, and nothing that touches people or places. Nothing reaches a target
without passing scope, a signed authorisation, an action guard and the audit log
first, and nothing reaches the report unless the audit chain supports it.

**This build is a research-lab beta.** Self-hosted, no accounts, no API keys
issued to anyone, no checkout, no billing. Start with [`BETA.md`](BETA.md) —
install, test, run, what to send back, and the discipline-by-discipline table of
what this covers and what it will not.

From 0.1.0, [`COMPATIBILITY.md`](COMPATIBILITY.md) is the promise: which parts of
the interface - commands, exit codes, the config home, the audit log, the
distribution - hold for every 0.1.x, and which parts are free to move.

It is not a red team, and it does not pretend to be one: it is the third of a
penetration test that can be automated, and it says so on the page, in
[`BETA.md`](BETA.md) and in the terms of use — all three rendered from one
description, `web/scope_taxonomy.py`.

* The page: <https://enigmaticred.com/> (`web/`, static). It carries no chat box:
  the chat lives on its own page, <https://beta.enigmaticred.com/>, which the landing
  page links to. That interface is **bring your own key**: it relays one turn to the
  model *you* name, with the key *you* paste in, and the deployment holds no model
  credential of its own — a turn with no key is refused (`401`) before anything is
  counted or forwarded. No key is ever issued by this project.
* The chat surface: `red` talks to your own model, and works one sentence
  with it — describe a target and a thing to check and that runs, while a
  question (`red "how do I write scope?"`) is answered and nothing else
  happens. A question needs no key when the endpoint is a model on your machine,
  and your own key (`LLM_API_KEY` or `FEATHERLESS_API_KEY`, one credential under
  either name - `red key` prompts for it and writes that line, which is the one
  way to set it without it ever reaching an argv) when it is hosted. One wheel,
  `py3-none-any`, runs it on Windows and Linux.
  Two kinds of line *are* a run, and each works typed at the prompt or passed as
  the one-shot `--message`. `/run <target>` is the one-step form: the model picks
  a single capability from the registry for that target. A plain line that names
  a target and asks for work — `hack localhost and check for anything related
  with api vulnerabilities` — is the mission form: one reading of the sentence
  fixes the anchor, then several steps, each chosen from what the last one
  showed. A structured task state tracks the seeded checks, the evidence and the
  gaps, and one is bounded by step, time, request, repeat and failure ceilings;
  resuming is an opt-in mission-API choice (`run_mission(state_path=...)`) that
  revalidates scope, attestation, audit chain and evidence before continuing.
  Host missions can include a bounded DNS lookup and a web/TLS posture check
  gated on web evidence. The completed Agent UI mission can be downloaded as a
  structured PDF, DOCX, Markdown or JSON report with evidence-based key points,
  explicit coverage gaps and unverified risk hypotheses.
  Both go through the same chain `red scan` builds: scope, signed attestation,
  guard, rate limit and audit log, with an intrusive command line stopping for
  your `y`/`n` on that exact line,
  both need `red init` and `red authorize` first, and neither can move off the
  asset you named: a path or service derived from it is allowed, another host
  is refused and audited. `/tools` lists what either may name, including
  `command`: one program named with its own arguments, run as a single argv with
  no shell and classed by that binary rather than by the word - `nmap` is active,
  a program nobody registered or a line that asks for something intrusive stops
  for your `y`/`n` on the exact line, and a pipe, a redirect or a second host is
  refused rather than interpreted. In the browser the same line is typed into the
  local agent panel and posted to `/api/exec`, which is offered only where
  `AGENT_MODE` allows a run. Everything else
  is still a conversation that runs nothing - though it may *read*: a chat turn
  is offered a closed, read-only list (this site's own tables, and the public
  metadata and text of a GitHub or Hugging Face repository), each one an
  unauthenticated `GET` with no target behind it and no audit line after it, and
  named in the transcript as `[read only]` rather than `[not run]`. See
  [`agent/freestyle.py`](agent/freestyle.py) and
  [`agent/mission.py`](agent/mission.py).
* The agent layer: [`agent/README.md`](agent/README.md).
* Offline artifact analysis: `red analyze` reads local Nmap XML, HTTP JSON/HAR,
  OpenAPI JSON/YAML, or raw HTTP files only. It makes no request and runs no
  command; imported evidence is hashed and audited, and analyzer output remains
  a lead unless a completed run verifies it. CVSS-B 4.0 scoring is calculated
  only for verified findings with a supplied base vector:

  ```powershell
  red analyze --target app.example.com --artifact .\evidence.har --json --output .\assessment.json
  ```
* The execution and safety core: `safety/`, `tools/`, and the README in each.
* The optional database behind the evidence: `db/` — a SQLAlchemy schema, an
  Alembic tree, and a mirror of the audit chain. It is in the `persistence`
  extra and off the scan path, so a scan never needs it. See `red db --help`.
* The archived subscription surface: [`archive/billing/README.md`](archive/billing/README.md).
* The write-ups: [`writeups/README.md`](writeups/README.md) — one folder per
  piece, one page per folder at <https://enigmaticred.com/writeups/>, and the
  same folders mirrored to `github.com/Enigmatic-Red/enigmatic-red-writeups`.

```powershell
python -m venv .venv; .venv\Scripts\Activate.ps1
pip install -r requirements.txt
copy .env.example .env              # the defaults are all a local run needs
.\setup_local_model.cmd             # a model on this machine: no key, no egress
python -m pytest -q                 # the whole suite, offline, no key needed
```

Linux is the same five steps in shell form:

```bash
python3 -m venv .venv
. .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env                # the defaults are all a local run needs
./setup_local_model.sh              # a model on this machine: no key, no egress
python -m pytest -q                 # the whole suite, offline, no key needed
```

The `setup_local_model.*` line is the one-click path: the script installs what
is missing, downloads an open-weight model to this machine and points the agent
at it, so a scan needs no key and no third-party model host. Windows runs
`setup_local_model.ps1`; Linux runs `setup_local_model.sh`, which stays
`bash`-compatible on purpose - it is the twin, not a subset. It reuses a
model the local Ollama already has rather than downloading one, honours
`OLLAMA_HOST` when the service is off the 11434 default, and leaves your `.env`
alone if you have already chosen an endpoint (backing it up to `.env.bak`
first). Pointing the agent at a local model needed no provider change, because
it already reads its endpoint from settings: the only edit under `agent/` was an
unrelated fix to the provider's `--list-models` helper, which used to print its
answer and then crash with `RuntimeError: Event loop is closed` on Windows.

The installed agent defaults to local Ollama (`llama3.2:3b`) and needs no API
key. In its **API & Models** screen, choose Ollama, one of the OpenAI-compatible
provider presets (including DeepInfra), or a custom endpoint; edit the endpoint
and fast/reasoning model IDs there, and optionally load the endpoint's model
list. Hosted providers must support Chat Completions, and agent runs additionally
need tool calling. The key is stored locally in `.env`, never returned to the
page. `red key` remains available in a terminal and never takes the secret as an
argument. The separate hosted chat page remains bring-your-own-key.

The installed Agent chat and hosted chat can draft custom code for benign,
defensive tasks such as input validation, local log analysis, secure
configuration, reports and tests. Their prompt directs the model away from
malware, exploit code, credential theft, evasion, persistence and data
exfiltration. Code is returned as an unexecuted draft; the chat does not write
or run it, and generated code still needs human review.

Windows has a shorter path still, for a reader with no checkout at all: the page
offers `EnigmaticRed-Setup.exe`, a single frozen file that installs the agent,
the desktop shell, and its server dependencies, and opens the **Enigmatic Red**
window when it finishes. The first run is that window's form: it is where scope
and written authorization are configured. Afterward the same shortcut opens the
dedicated desktop workspace. The workspace is not the marketing site or hosted chat:
it talks only to the loopback-only agent backend, shows mission steps and audit
status, and asks for approval of the exact command when an intrusive step needs
it. It opens on the promise the rest of this file is held to - **Your agent.
Your scope. Your call.** over *Plan with proof.* - and shares one design language
with the page and the hosted chat, so what the site looks like is what the
install opens. The existing scope, guard, authorization, and audit chain remain
the only
execution path. The app uses Microsoft Edge WebView2; if the desktop window
cannot start, its error message names the missing runtime or dependency. It is a *bootstrapper*
(`installer/launcher.py`, standard library only) rather than a second copy of the
agent - it installs Python with `winget` when it is missing, downloads the
versioned wheel published beside it and checks its SHA-256, runs `red init`,
installs Ollama and pulls **Llama** (`llama3.2:3b` by default: the newest Llama
that runs on a CPU, since Llama 4's smallest tag is 67 GB), writes the `.env`
block the setup script writes, and bundles only the dedicated agent workspace.
The installed server serves that page without loading the hosted beta or the
marketing site. Rebuild it with
`installer/build.ps1`; `tests/test_installer.py` fails if its imports leave the
standard library or its pinned digest drifts from the wheel it ships.

To exercise a build without touching a machine's live install, redirect
`%APPDATA%` and `%USERPROFILE%` to a scratch directory before launching it: the
per-user Start Menu is resolved from the first and the Desktop from the second
(`start_menu_dir()` and `desktop_dir()` in `installer/launcher.py`), so every
shortcut the run writes lands inside that directory and the real ones are left
byte-for-byte as they were.

Authorised testing only. The shipped scope example is loopback-only; read it
before pointing this at anything you do not own.

## Prior art and attribution

`agent/exploration.py` implements the exploration-route bookkeeping described by
**ARTEX** (`Autumn-27/ARTEX`, AGPL-3.0; the upstream repository is no longer
public, so the readable mirror is `BaaRai/ARTEX`). That module is an independent
Python implementation: it carries no ARTEX source, and what it reproduces is the
project's published *design contract*, quoted and attributed at the point of use.
The attribution is also a term of this project's licence - see `LICENSE` §2(c) -
and the per-module record of what came from where is `PROVENANCE.md`.

Nothing else in this tree derives from ARTEX, and no AGPL-licensed source is
vendored here. The rule is written down in `AGENTS.md` so that it stays true.
