# moopinger/smugglefuzz architecture

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

- Interactive diagram: https://gitdiagram.com/moopinger/smugglefuzz
- Repository: https://github.com/moopinger/smugglefuzz

## Overview

SmuggleFuzz is a command-line scanner for HTTP/2-to-HTTP/1 downgrade request-smuggling vulnerabilities. Users can scan one or more targets with built-in or custom gadget payloads, submit a single crafted request, or list the gadget sets. The scan workflow parses targets and payloads, establishes HTTP/2 connections, sends crafted frames, and interprets responses and timeouts; optional confirmation resends a timed-out payload with a completing body. The graph follows the shown command-to-library calls and README-described behavior; unsampled implementation details are not expanded.

Main entry points: [`cmd/scan.go`](https://github.com/moopinger/smugglefuzz/blob/main/cmd/scan.go) (Scan command), [`cmd/request.go`](https://github.com/moopinger/smugglefuzz/blob/main/cmd/request.go) (Request command), [`cmd/root.go`](https://github.com/moopinger/smugglefuzz/blob/main/cmd/root.go) (Command root), [`cmd/output.go`](https://github.com/moopinger/smugglefuzz/blob/main/cmd/output.go) (Gadget listing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI commands"]
  node_entry["Program entry<br/>[main.go]"]
  node_root["Command root<br/>[root.go]"]
  node_scan["Scan command<br/>[scan.go]"]
  node_request["Request command<br/>[request.go]"]
  node_outputcmd["Gadget listing<br/>[output.go]"]
end

subgraph group_workflow["Scan workflow"]
  node_targets["Target parsing and TLS<br/>[target.go]"]
  node_jobs["Scan job state<br/>[scanjob.go]"]
end

subgraph group_protocol["HTTP/2 protocol"]
  node_http2["HTTP/2 framing and I/O<br/>[http2.go]"]
end

subgraph group_payloads["Payloads and results"]
  node_payloads["Payload import and chunking<br/>[payload.go]"]
  node_gadgetsets["Built-in gadget sets<br/>[constants.go]"]
  node_format["Response formatting<br/>[output.go]"]
  node_saved["Saved confirmations<br/>[payload.go]"]
end

node_user(("User"))
node_targetserver(("HTTP/2 target"))

node_user -->|"runs"| node_entry
node_entry -->|"executes"| node_root
node_user -->|"invokes"| node_scan
node_user -->|"invokes"| node_request
node_user -->|"invokes"| node_outputcmd
node_root -->|"registers"| node_scan
node_root -->|"registers"| node_request
node_root -->|"registers"| node_outputcmd
node_scan -->|"parses and connects"| node_targets
node_scan -->|"imports and chunks"| node_payloads
node_scan -->|"selects defaults"| node_gadgetsets
node_scan -->|"creates"| node_jobs
node_scan -->|"sends and handles"| node_http2
node_scan -->|"formats results"| node_format
node_scan -->|"writes confirmations"| node_saved
node_request -->|"parses and connects"| node_targets
node_request -->|"imports attack"| node_payloads
node_request -->|"creates"| node_jobs
node_request -->|"sends and handles"| node_http2
node_request -->|"formats result"| node_format
node_outputcmd -->|"prints"| node_gadgetsets
node_targets -->|"opens TLS"| node_targetserver
node_http2 -->|"exchanges frames"| node_targetserver

click node_entry "https://github.com/moopinger/smugglefuzz/blob/main/main.go"
click node_root "https://github.com/moopinger/smugglefuzz/blob/main/cmd/root.go"
click node_scan "https://github.com/moopinger/smugglefuzz/blob/main/cmd/scan.go"
click node_request "https://github.com/moopinger/smugglefuzz/blob/main/cmd/request.go"
click node_outputcmd "https://github.com/moopinger/smugglefuzz/blob/main/cmd/output.go"
click node_targets "https://github.com/moopinger/smugglefuzz/blob/main/lib/target.go"
click node_jobs "https://github.com/moopinger/smugglefuzz/blob/main/lib/scanjob.go"
click node_payloads "https://github.com/moopinger/smugglefuzz/blob/main/lib/payload.go"
click node_gadgetsets "https://github.com/moopinger/smugglefuzz/blob/main/lib/constants.go"
click node_http2 "https://github.com/moopinger/smugglefuzz/blob/main/lib/http2.go"
click node_format "https://github.com/moopinger/smugglefuzz/blob/main/lib/output.go"
click node_saved "https://github.com/moopinger/smugglefuzz/blob/main/lib/payload.go"

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_entry,node_root,node_scan,node_request,node_outputcmd,node_user toneBlue
class node_targets,node_jobs toneAmber
class node_http2 toneMint
class node_payloads,node_gadgetsets,node_format,node_saved toneRose
class node_targetserver toneIndigo
```

## Components

### CLI commands

- [Program entry](https://github.com/moopinger/smugglefuzz/blob/main/main.go): `main.go`
- [Command root](https://github.com/moopinger/smugglefuzz/blob/main/cmd/root.go): `cmd/root.go`
- [Scan command](https://github.com/moopinger/smugglefuzz/blob/main/cmd/scan.go): `cmd/scan.go`
- [Request command](https://github.com/moopinger/smugglefuzz/blob/main/cmd/request.go): `cmd/request.go`
- [Gadget listing](https://github.com/moopinger/smugglefuzz/blob/main/cmd/output.go): `cmd/output.go`

### Scan workflow

- [Target parsing and TLS](https://github.com/moopinger/smugglefuzz/blob/main/lib/target.go): `lib/target.go`
- [Scan job state](https://github.com/moopinger/smugglefuzz/blob/main/lib/scanjob.go): `lib/scanjob.go`

### HTTP/2 protocol

- [HTTP/2 framing and I/O](https://github.com/moopinger/smugglefuzz/blob/main/lib/http2.go): `lib/http2.go`

### Payloads and results

- [Payload import and chunking](https://github.com/moopinger/smugglefuzz/blob/main/lib/payload.go): `lib/payload.go`
- [Built-in gadget sets](https://github.com/moopinger/smugglefuzz/blob/main/lib/constants.go): `lib/constants.go`
- [Response formatting](https://github.com/moopinger/smugglefuzz/blob/main/lib/output.go): `lib/output.go`
- [Saved confirmations](https://github.com/moopinger/smugglefuzz/blob/main/lib/payload.go): `lib/payload.go`

### Other components

- **User**
- **HTTP/2 target**

## Connections

- User → Program entry: runs (evidence: `README.md`)
- Program entry → Command root: executes (evidence: `main.go`)
- User → Scan command: invokes (evidence: `README.md`)
- User → Request command: invokes (evidence: `README.md`)
- User → Gadget listing: invokes (evidence: `README.md`)
- Command root → Scan command: registers (evidence: `cmd/scan.go`)
- Command root → Request command: registers (evidence: `cmd/request.go`)
- Command root → Gadget listing: registers (evidence: `cmd/output.go`)
- Scan command → Target parsing and TLS: parses and connects (evidence: `cmd/scan.go`)
- Scan command → Payload import and chunking: imports and chunks (evidence: `cmd/scan.go`)
- Scan command → Built-in gadget sets: selects defaults (evidence: `cmd/scan.go`)
- Scan command → Scan job state: creates (evidence: `cmd/scan.go`)
- Scan command → HTTP/2 framing and I/O: sends and handles (evidence: `cmd/scan.go`)
- Scan command → Response formatting: formats results (evidence: `cmd/scan.go`)
- Scan command → Saved confirmations: writes confirmations (evidence: `cmd/scan.go`)
- Request command → Target parsing and TLS: parses and connects (evidence: `cmd/request.go`)
- Request command → Payload import and chunking: imports attack (evidence: `cmd/request.go`)
- Request command → Scan job state: creates (evidence: `cmd/request.go`)
- Request command → HTTP/2 framing and I/O: sends and handles (evidence: `cmd/request.go`)
- Request command → Response formatting: formats result (evidence: `cmd/request.go`)
- Gadget listing → Built-in gadget sets: prints (evidence: `cmd/output.go`)
- Target parsing and TLS → HTTP/2 target: opens TLS (evidence: `lib/target.go`)
- HTTP/2 framing and I/O → HTTP/2 target: exchanges frames (evidence: `lib/http2.go`)
