# han122400/local-attack-agent architecture

> Architecture diagram of the GitHub repository han122400/local-attack-agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/han122400/local-attack-agent
- Repository: https://github.com/han122400/local-attack-agent

## Overview

Local Attack Agent is a bounded reconnaissance dashboard for a local OWASP Juice Shop, driven by a locally running Ollama model. A user selects a model and starts a run; the API delegates to the v2 explorer, which observes the browser and network, asks for a plan and permitted next action, and records evidence. Selected read-only requests can proceed to hypothesis experiments and response comparison. The dashboard presents run state, observations, decisions, and lab/model status. The README documents these capabilities; sampled excerpts do not expose every internal call, so some documented links cite the README.

Main entry points: [`v2.py`](https://github.com/han122400/local-attack-agent/blob/main/v2.py) (Run manager), [`app.py`](https://github.com/han122400/local-attack-agent/blob/main/app.py) (FastAPI API), [`lab.py`](https://github.com/han122400/local-attack-agent/blob/main/lab.py) (Lab status/start), [`static/index.html`](https://github.com/han122400/local-attack-agent/blob/main/static/index.html) (Dashboard UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Dashboard"]
  node_dashboard_ui["Dashboard UI<br/>[index.html]"]
  node_dashboard_logic["Dashboard logic<br/>[app.js]"]
  node_ollama_ui["Model status UI<br/>[ollama-status.js]"]
end

subgraph group_runtime["Run orchestration"]
  node_api["FastAPI API<br/>[app.py]"]
  node_explorer["Run manager<br/>[v2.py]"]
  node_planner["Decision contract<br/>[planning.py]"]
end

subgraph group_recon["Recon and experiments"]
  node_browser["Browser observer<br/>[v2.py]"]
  node_network_tracker["Request tracker<br/>[v2.py]"]
  node_observations[("Evidence records<br/>[v2.py]")]
  node_action_executor["Action executor<br/>[v2.py]"]
  node_hypothesis["Hypothesis experiments<br/>[v2.py]"]
  node_response_compare["Response comparison<br/>[v2.py]"]
end

subgraph group_services["Local services"]
  node_lab_status["Lab status/start<br/>[lab.py]"]
  node_juice_shop[("Juice Shop")]
  node_ollama[("Ollama service")]
end

node_user(("Operator"))

node_user -->|"operates"| node_dashboard_ui
node_dashboard_ui -->|"loads"| node_dashboard_logic
node_dashboard_logic -->|"requests state"| node_api
node_api -->|"delegates runs"| node_explorer
node_api -->|"reads and starts"| node_lab_status
node_api -->|"lists and checks"| node_ollama
node_explorer -->|"drives observation"| node_browser
node_browser -->|"observes HTTP"| node_juice_shop
node_browser -.->|"tracks requests"| node_network_tracker
node_network_tracker -.->|"records evidence"| node_observations
node_browser -.->|"captures screens"| node_observations
node_explorer -->|"uses decisions"| node_planner
node_explorer -->|"requests plans"| node_ollama
node_explorer -->|"dispatches actions"| node_action_executor
node_action_executor -.->|"acts on page"| node_browser
node_explorer -->|"runs experiments"| node_hypothesis
node_hypothesis -->|"requests hypothesis"| node_ollama
node_hypothesis -->|"compares responses"| node_response_compare
node_response_compare -.->|"records results"| node_observations
node_ollama_ui -->|"polls status"| node_api
node_lab_status -->|"checks readiness"| node_juice_shop
node_lab_status -->|"starts container"| node_juice_shop

click node_dashboard_ui "https://github.com/han122400/local-attack-agent/blob/main/static/index.html"
click node_dashboard_logic "https://github.com/han122400/local-attack-agent/blob/main/static/app.js"
click node_ollama_ui "https://github.com/han122400/local-attack-agent/blob/main/static/ollama-status.js"
click node_api "https://github.com/han122400/local-attack-agent/blob/main/app.py"
click node_explorer "https://github.com/han122400/local-attack-agent/blob/main/v2.py"
click node_planner "https://github.com/han122400/local-attack-agent/blob/main/planning.py"
click node_browser "https://github.com/han122400/local-attack-agent/blob/main/v2.py"
click node_network_tracker "https://github.com/han122400/local-attack-agent/blob/main/v2.py"
click node_observations "https://github.com/han122400/local-attack-agent/blob/main/v2.py"
click node_action_executor "https://github.com/han122400/local-attack-agent/blob/main/v2.py"
click node_hypothesis "https://github.com/han122400/local-attack-agent/blob/main/v2.py"
click node_response_compare "https://github.com/han122400/local-attack-agent/blob/main/v2.py"
click node_lab_status "https://github.com/han122400/local-attack-agent/blob/main/lab.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_dashboard_ui,node_dashboard_logic,node_ollama_ui toneBlue
class node_api,node_explorer,node_planner toneAmber
class node_browser,node_network_tracker,node_observations,node_action_executor,node_hypothesis,node_response_compare toneMint
class node_lab_status,node_juice_shop,node_ollama toneRose
class node_user toneIndigo
```

## Components

### Dashboard

- [Dashboard UI](https://github.com/han122400/local-attack-agent/blob/main/static/index.html): `static/index.html`
- [Dashboard logic](https://github.com/han122400/local-attack-agent/blob/main/static/app.js): `static/app.js`
- [Model status UI](https://github.com/han122400/local-attack-agent/blob/main/static/ollama-status.js): `static/ollama-status.js`

### Run orchestration

- [FastAPI API](https://github.com/han122400/local-attack-agent/blob/main/app.py): `app.py`
- [Run manager](https://github.com/han122400/local-attack-agent/blob/main/v2.py): `v2.py`
- [Decision contract](https://github.com/han122400/local-attack-agent/blob/main/planning.py): `planning.py`

### Recon and experiments

- [Browser observer](https://github.com/han122400/local-attack-agent/blob/main/v2.py): `v2.py`
- [Request tracker](https://github.com/han122400/local-attack-agent/blob/main/v2.py): `v2.py`
- [Evidence records](https://github.com/han122400/local-attack-agent/blob/main/v2.py): `v2.py`
- [Action executor](https://github.com/han122400/local-attack-agent/blob/main/v2.py): `v2.py`
- [Hypothesis experiments](https://github.com/han122400/local-attack-agent/blob/main/v2.py): `v2.py`
- [Response comparison](https://github.com/han122400/local-attack-agent/blob/main/v2.py): `v2.py`

### Local services

- [Lab status/start](https://github.com/han122400/local-attack-agent/blob/main/lab.py): `lab.py`
- **Juice Shop**
- **Ollama service**

### Other components

- **Operator**

## Connections

- Operator → Dashboard UI: operates (evidence: `README.md`)
- Dashboard UI → Dashboard logic: loads (evidence: `static/app.js`)
- Dashboard logic → FastAPI API: requests state (evidence: `static/app.js`)
- FastAPI API → Run manager: delegates runs (evidence: `app.py`)
- FastAPI API → Lab status/start: reads and starts (evidence: `app.py`)
- FastAPI API → Ollama service: lists and checks (evidence: `app.py`)
- Run manager → Browser observer: drives observation (evidence: `README.md`)
- Browser observer → Juice Shop: observes HTTP (evidence: `README.md`)
- Browser observer → Request tracker: tracks requests (evidence: `v2.py`)
- Request tracker → Evidence records: records evidence (evidence: `v2.py`)
- Browser observer → Evidence records: captures screens (evidence: `v2.py`)
- Run manager → Decision contract: uses decisions (evidence: `v2.py`)
- Run manager → Ollama service: requests plans (evidence: `README.md`)
- Run manager → Action executor: dispatches actions (evidence: `v2.py`)
- Action executor → Browser observer: acts on page (evidence: `v2.py`)
- Run manager → Hypothesis experiments: runs experiments (evidence: `v2.py`)
- Hypothesis experiments → Ollama service: requests hypothesis (evidence: `v2.py`)
- Hypothesis experiments → Response comparison: compares responses (evidence: `README.md`)
- Response comparison → Evidence records: records results (evidence: `v2.py`)
- Model status UI → FastAPI API: polls status (evidence: `static/ollama-status.js`)
- Lab status/start → Juice Shop: checks readiness (evidence: `lab.py`)
- Lab status/start → Juice Shop: starts container (evidence: `lab.py`)
