# des1red/cwrap architecture

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

- Interactive diagram: https://gitdiagram.com/des1red/cwrap
- Repository: https://github.com/des1red/cwrap

## Overview

cwrap is a CLI for identity-aware HTTP testing: users express fetch/send intent, discover targets with scan or recon, then confirm findings and expand exploit chains from recon reports. Its central recon workflow probes with multiple identities, compares responses, records authorization signals, and writes a report; session persistence supports later runs. The README documents these capabilities, but the excerpts do not show most runtime dispatch and call sites, so several links are documented workflow relationships rather than traced calls.

Main entry points: [`internal/recon/recon.go`](https://github.com/des1red/cwrap/blob/main/internal/recon/recon.go) (Recon orchestration), [`internal/recon/behavior`](https://github.com/des1red/cwrap/tree/main/internal/recon/behavior) (Identity probing), [`internal/exploit/probe`](https://github.com/des1red/cwrap/tree/main/internal/exploit/probe) (Exploit probes), [`cmd/root.go`](https://github.com/des1red/cwrap/blob/main/cmd/root.go) (Command interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI and requests"]
  node_commands["Command interface<br/>[root.go]"]
  node_intent["HTTP intent"]
  node_request["Request execution"]
  node_fetchsend["Fetch and send"]
end

subgraph group_discovery["Surface discovery"]
  node_scan["Staged scan"]
  node_baseline["Baseline filtering<br/>[baseline.go]"]
end

subgraph group_recon["Identity-aware recon"]
  node_recon["Recon orchestration<br/>[recon.go]"]
  node_httpengine["HTTP analysis"]
  node_apiengine["API analysis"]
  node_behavior["Identity probing"]
  node_intel["Endpoint intelligence"]
  node_knowledge["Findings knowledge"]
  node_transport["HTTP transport"]
end

subgraph group_reporting["Reports and state"]
  node_sessions[("Session persistence")]
  node_report["Recon reports"]
end

subgraph group_exploit["Exploit confirmation"]
  node_reportload["Report loading"]
  node_probes["Exploit probes"]
  node_chains["Exploit chains"]
  node_replay["HTTP replay"]
  node_results["Exploit results"]
end

node_user(("User"))

node_user -->|"runs commands"| node_commands
node_commands -->|"expresses intent"| node_intent
node_intent -->|"builds requests"| node_request
node_user -->|"requests resources"| node_fetchsend
node_user -->|"discovers paths"| node_scan
node_scan -->|"filters responses"| node_baseline
node_user -->|"starts analysis"| node_recon
node_recon -->|"selects profile"| node_httpengine
node_recon -->|"selects profile"| node_apiengine
node_httpengine -->|"probes identities"| node_behavior
node_apiengine -->|"probes identities"| node_behavior
node_behavior -.->|"sends probes"| node_transport
node_behavior -->|"learns endpoints"| node_intel
node_behavior -->|"records observations"| node_knowledge
node_recon -->|"reuses sessions"| node_sessions
node_recon -->|"writes findings"| node_report
node_user -->|"supplies report"| node_reportload
node_reportload -->|"loads for testing"| node_probes
node_probes -.->|"replays requests"| node_replay
node_probes -->|"expands findings"| node_chains
node_probes -.->|"records outcomes"| node_results

click node_commands "https://github.com/des1red/cwrap/blob/main/cmd/root.go"
click node_intent "https://github.com/des1red/cwrap/tree/main/internal/intent"
click node_request "https://github.com/des1red/cwrap/tree/main/internal/runner"
click node_fetchsend "https://github.com/des1red/cwrap/tree/main/internal/intent"
click node_scan "https://github.com/des1red/cwrap/tree/main/internal/scan"
click node_baseline "https://github.com/des1red/cwrap/blob/main/internal/scan/baseline.go"
click node_recon "https://github.com/des1red/cwrap/blob/main/internal/recon/recon.go"
click node_httpengine "https://github.com/des1red/cwrap/tree/main/internal/recon/http"
click node_apiengine "https://github.com/des1red/cwrap/tree/main/internal/recon/api"
click node_behavior "https://github.com/des1red/cwrap/tree/main/internal/recon/behavior"
click node_intel "https://github.com/des1red/cwrap/tree/main/internal/recon/jsintel"
click node_knowledge "https://github.com/des1red/cwrap/tree/main/internal/recon/knowledge"
click node_transport "https://github.com/des1red/cwrap/tree/main/internal/recon/transport"
click node_sessions "https://github.com/des1red/cwrap/tree/main/internal/recon/session"
click node_report "https://github.com/des1red/cwrap/tree/main/internal/recon/report"
click node_reportload "https://github.com/des1red/cwrap/tree/main/internal/exploit/report"
click node_probes "https://github.com/des1red/cwrap/tree/main/internal/exploit/probe"
click node_chains "https://github.com/des1red/cwrap/tree/main/internal/exploit/chain"
click node_replay "https://github.com/des1red/cwrap/tree/main/internal/exploit/replay"
click node_results "https://github.com/des1red/cwrap/tree/main/internal/exploit/result"

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_commands,node_intent,node_request,node_fetchsend,node_user toneBlue
class node_scan,node_baseline toneAmber
class node_recon,node_httpengine,node_apiengine,node_behavior,node_intel,node_knowledge,node_transport toneMint
class node_sessions,node_report toneRose
class node_reportload,node_probes,node_chains,node_replay,node_results toneIndigo
```

## Components

### CLI and requests

- [Command interface](https://github.com/des1red/cwrap/blob/main/cmd/root.go): `cmd/root.go`
- [HTTP intent](https://github.com/des1red/cwrap/tree/main/internal/intent): `internal/intent`
- [Request execution](https://github.com/des1red/cwrap/tree/main/internal/runner): `internal/runner`
- [Fetch and send](https://github.com/des1red/cwrap/tree/main/internal/intent): `internal/intent`

### Surface discovery

- [Staged scan](https://github.com/des1red/cwrap/tree/main/internal/scan): `internal/scan`
- [Baseline filtering](https://github.com/des1red/cwrap/blob/main/internal/scan/baseline.go): `internal/scan/baseline.go`

### Identity-aware recon

- [Recon orchestration](https://github.com/des1red/cwrap/blob/main/internal/recon/recon.go): `internal/recon/recon.go`
- [HTTP analysis](https://github.com/des1red/cwrap/tree/main/internal/recon/http): `internal/recon/http`
- [API analysis](https://github.com/des1red/cwrap/tree/main/internal/recon/api): `internal/recon/api`
- [Identity probing](https://github.com/des1red/cwrap/tree/main/internal/recon/behavior): `internal/recon/behavior`
- [Endpoint intelligence](https://github.com/des1red/cwrap/tree/main/internal/recon/jsintel): `internal/recon/jsintel`
- [Findings knowledge](https://github.com/des1red/cwrap/tree/main/internal/recon/knowledge): `internal/recon/knowledge`
- [HTTP transport](https://github.com/des1red/cwrap/tree/main/internal/recon/transport): `internal/recon/transport`

### Reports and state

- [Session persistence](https://github.com/des1red/cwrap/tree/main/internal/recon/session): `internal/recon/session`
- [Recon reports](https://github.com/des1red/cwrap/tree/main/internal/recon/report): `internal/recon/report`

### Exploit confirmation

- [Report loading](https://github.com/des1red/cwrap/tree/main/internal/exploit/report): `internal/exploit/report`
- [Exploit probes](https://github.com/des1red/cwrap/tree/main/internal/exploit/probe): `internal/exploit/probe`
- [Exploit chains](https://github.com/des1red/cwrap/tree/main/internal/exploit/chain): `internal/exploit/chain`
- [HTTP replay](https://github.com/des1red/cwrap/tree/main/internal/exploit/replay): `internal/exploit/replay`
- [Exploit results](https://github.com/des1red/cwrap/tree/main/internal/exploit/result): `internal/exploit/result`

### Other components

- **User**

## Connections

- User → Command interface: runs commands (evidence: `README.md`)
- Command interface → HTTP intent: expresses intent (evidence: `README.md`)
- HTTP intent → Request execution: builds requests (evidence: `README.md`)
- User → Fetch and send: requests resources (evidence: `README.md`)
- User → Staged scan: discovers paths (evidence: `README.md`)
- Staged scan → Baseline filtering: filters responses (evidence: `README.md`)
- User → Recon orchestration: starts analysis (evidence: `README.md`)
- Recon orchestration → HTTP analysis: selects profile (evidence: `README.md`)
- Recon orchestration → API analysis: selects profile (evidence: `README.md`)
- HTTP analysis → Identity probing: probes identities (evidence: `internal/recon/http/engine.go`)
- API analysis → Identity probing: probes identities (evidence: `internal/recon/api/engine.go`)
- Identity probing → HTTP transport: sends probes
- Identity probing → Endpoint intelligence: learns endpoints (evidence: `README.md`)
- Identity probing → Findings knowledge: records observations (evidence: `internal/recon/behavior/storage.go`)
- Recon orchestration → Session persistence: reuses sessions (evidence: `README.md`)
- Recon orchestration → Recon reports: writes findings (evidence: `README.md`)
- User → Report loading: supplies report (evidence: `README.md`)
- Report loading → Exploit probes: loads for testing (evidence: `README.md`)
- Exploit probes → HTTP replay: replays requests
- Exploit probes → Exploit chains: expands findings (evidence: `README.md`)
- Exploit probes → Exploit results: records outcomes
