# zan8in/afrog architecture

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

- Interactive diagram: https://gitdiagram.com/zan8in/afrog
- Repository: https://github.com/zan8in/afrog

## Overview

Afrog is a Go security-scanning toolkit for bug bounty, pentest, and red-team work. In its principal CLI workflow, an operator supplies targets and scan options; the runner performs discovery and fingerprinting, executes built-in or custom PoCs, and emits findings and reports. The repository also exposes scanning through a gRPC API and an embeddable SDK, plus a web console and licensed curated-PoC support. Connections below rely on README statements and the supplied source excerpts or index; unsampled implementation details are not asserted.

Main entry points: [`pkg/runner/engine.go`](https://github.com/zan8in/afrog/blob/main/pkg/runner/engine.go) (Scan runner), [`cmd/afrog/main.go`](https://github.com/zan8in/afrog/blob/main/cmd/afrog/main.go) (CLI), [`pkg/poc/poc.go`](https://github.com/zan8in/afrog/blob/main/pkg/poc/poc.go) (PoC model), [`pkg/config/options.go`](https://github.com/zan8in/afrog/blob/main/pkg/config/options.go) (Scan options)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry points"]
  node_cli["CLI<br/>[main.go]"]
  node_options["Scan options<br/>[options.go]"]
end

subgraph group_scan["Scanning engine"]
  node_runner["Scan runner<br/>[engine.go]"]
  node_portscan["Port discovery<br/>[scan.go]"]
  node_fingerprint["Fingerprinting<br/>[engine.go]"]
  node_httpclient["HTTP client<br/>[client.go]"]
end

subgraph group_pocs["PoC sources"]
  node_poc["PoC model<br/>[poc.go]"]
  node_pocrepo["PoC repository<br/>[repo.go]"]
  node_builtin["Built-in checks<br/>[pocs.go]"]
  node_validator["PoC validation<br/>[validator.go]"]
  node_curated["Curated PoCs<br/>[service.go]"]
  node_curatedapi["Curated service API<br/>[client.go]"]
end

subgraph group_interfaces["Interfaces"]
  node_sdk["Go SDK<br/>[scanner.go]"]
  node_scanapi["gRPC API<br/>[server.go]"]
  node_taskmanager["Task manager<br/>[manager.go]"]
  node_web["Web console<br/>[handlers.go]"]
end

subgraph group_state["Results and integrations"]
  node_db[("SQLite results<br/>[sqlitex.go]")]
  node_result["Findings<br/>[result.go]"]
  node_report["Reports<br/>[default.go]"]
  node_notify["Notifications<br/>[notifier.go]"]
end

node_operator(("Operator"))
node_target(("Scan targets"))
node_grpcclient(("API client"))
node_sdkhost(("Go application"))
node_curatedservice(("Curated service"))

node_operator -->|"starts scan"| node_cli
node_cli -->|"loads options"| node_options
node_cli -->|"runs scan"| node_runner
node_target -.->|"provides targets"| node_runner
node_options -->|"configures"| node_runner
node_runner -->|"discovers ports"| node_portscan
node_runner -->|"fingerprints targets"| node_fingerprint
node_runner -->|"loads PoCs"| node_pocrepo
node_runner -->|"executes checks"| node_httpclient
node_fingerprint -->|"uses PoCs"| node_poc
node_pocrepo -->|"loads definitions"| node_poc
node_builtin -->|"defines checks"| node_poc
node_validator -->|"validates"| node_poc
node_options -->|"configures sources"| node_pocrepo
node_cli -->|"mounts curated PoCs"| node_curated
node_curated -->|"uses client"| node_curatedapi
node_curatedapi -.->|"requests content"| node_curatedservice
node_sdkhost -->|"embeds scanner"| node_sdk
node_sdk -->|"runs scan"| node_runner
node_grpcclient -.->|"submits scans"| node_scanapi
node_cli -->|"serves API"| node_scanapi
node_scanapi -->|"delegates tasks"| node_taskmanager
node_taskmanager -.->|"starts execution"| node_runner
node_web -->|"queries findings"| node_db
node_runner -->|"produces findings"| node_result
node_runner -->|"persists results"| node_db
node_result -.->|"renders reports"| node_report
node_cli -->|"sends alerts"| node_notify

click node_cli "https://github.com/zan8in/afrog/blob/main/cmd/afrog/main.go"
click node_options "https://github.com/zan8in/afrog/blob/main/pkg/config/options.go"
click node_runner "https://github.com/zan8in/afrog/blob/main/pkg/runner/engine.go"
click node_portscan "https://github.com/zan8in/afrog/blob/main/pkg/portscan/scan.go"
click node_fingerprint "https://github.com/zan8in/afrog/blob/main/pkg/fingerprint/engine.go"
click node_httpclient "https://github.com/zan8in/afrog/blob/main/pkg/protocols/http/retryhttpclient/client.go"
click node_poc "https://github.com/zan8in/afrog/blob/main/pkg/poc/poc.go"
click node_pocrepo "https://github.com/zan8in/afrog/blob/main/pkg/pocsrepo/repo.go"
click node_builtin "https://github.com/zan8in/afrog/blob/main/pocs/pocs.go"
click node_validator "https://github.com/zan8in/afrog/blob/main/pkg/validator/validator.go"
click node_curated "https://github.com/zan8in/afrog/blob/main/pkg/curated/service/service.go"
click node_curatedapi "https://github.com/zan8in/afrog/blob/main/pkg/curated/api/client.go"
click node_sdk "https://github.com/zan8in/afrog/blob/main/pkg/sdk/scanner.go"
click node_scanapi "https://github.com/zan8in/afrog/blob/main/pkg/scanapi/server.go"
click node_taskmanager "https://github.com/zan8in/afrog/blob/main/pkg/scantask/manager.go"
click node_web "https://github.com/zan8in/afrog/blob/main/pkg/web/handlers.go"
click node_db "https://github.com/zan8in/afrog/blob/main/pkg/db/sqlite/sqlitex.go"
click node_result "https://github.com/zan8in/afrog/blob/main/pkg/result/result.go"
click node_report "https://github.com/zan8in/afrog/blob/main/pkg/report/default.go"
click node_notify "https://github.com/zan8in/afrog/blob/main/pkg/notify/notifier.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_cli,node_options,node_grpcclient toneBlue
class node_runner,node_portscan,node_fingerprint,node_httpclient toneAmber
class node_poc,node_pocrepo,node_builtin,node_validator,node_curated,node_curatedapi toneMint
class node_sdk,node_scanapi,node_taskmanager,node_web toneRose
class node_db,node_result,node_report,node_notify,node_operator,node_target,node_sdkhost,node_curatedservice toneIndigo
```

## Components

### Entry points

- [CLI](https://github.com/zan8in/afrog/blob/main/cmd/afrog/main.go): `cmd/afrog/main.go`
- [Scan options](https://github.com/zan8in/afrog/blob/main/pkg/config/options.go): `pkg/config/options.go`

### Scanning engine

- [Scan runner](https://github.com/zan8in/afrog/blob/main/pkg/runner/engine.go): `pkg/runner/engine.go`
- [Port discovery](https://github.com/zan8in/afrog/blob/main/pkg/portscan/scan.go): `pkg/portscan/scan.go`
- [Fingerprinting](https://github.com/zan8in/afrog/blob/main/pkg/fingerprint/engine.go): `pkg/fingerprint/engine.go`
- [HTTP client](https://github.com/zan8in/afrog/blob/main/pkg/protocols/http/retryhttpclient/client.go): `pkg/protocols/http/retryhttpclient/client.go`

### PoC sources

- [PoC model](https://github.com/zan8in/afrog/blob/main/pkg/poc/poc.go): `pkg/poc/poc.go`
- [PoC repository](https://github.com/zan8in/afrog/blob/main/pkg/pocsrepo/repo.go): `pkg/pocsrepo/repo.go`
- [Built-in checks](https://github.com/zan8in/afrog/blob/main/pocs/pocs.go): `pocs/pocs.go`
- [PoC validation](https://github.com/zan8in/afrog/blob/main/pkg/validator/validator.go): `pkg/validator/validator.go`
- [Curated PoCs](https://github.com/zan8in/afrog/blob/main/pkg/curated/service/service.go): `pkg/curated/service/service.go`
- [Curated service API](https://github.com/zan8in/afrog/blob/main/pkg/curated/api/client.go): `pkg/curated/api/client.go`

### Interfaces

- [Go SDK](https://github.com/zan8in/afrog/blob/main/pkg/sdk/scanner.go): `pkg/sdk/scanner.go`
- [gRPC API](https://github.com/zan8in/afrog/blob/main/pkg/scanapi/server.go): `pkg/scanapi/server.go`
- [Task manager](https://github.com/zan8in/afrog/blob/main/pkg/scantask/manager.go): `pkg/scantask/manager.go`
- [Web console](https://github.com/zan8in/afrog/blob/main/pkg/web/handlers.go): `pkg/web/handlers.go`

### Results and integrations

- [SQLite results](https://github.com/zan8in/afrog/blob/main/pkg/db/sqlite/sqlitex.go): `pkg/db/sqlite/sqlitex.go`
- [Findings](https://github.com/zan8in/afrog/blob/main/pkg/result/result.go): `pkg/result/result.go`
- [Reports](https://github.com/zan8in/afrog/blob/main/pkg/report/default.go): `pkg/report/default.go`
- [Notifications](https://github.com/zan8in/afrog/blob/main/pkg/notify/notifier.go): `pkg/notify/notifier.go`

### Other components

- **Operator**
- **Scan targets**
- **API client**
- **Go application**
- **Curated service**

## Connections

- Operator → CLI: starts scan (evidence: `cmd/afrog/main.go`)
- CLI → Scan options: loads options (evidence: `cmd/afrog/main.go`)
- CLI → Scan runner: runs scan (evidence: `cmd/afrog/main.go`)
- Scan targets → Scan runner: provides targets (evidence: `README.md`)
- Scan options → Scan runner: configures (evidence: `pkg/runner/engine.go`)
- Scan runner → Port discovery: discovers ports (evidence: `pkg/runner/engine.go`)
- Scan runner → Fingerprinting: fingerprints targets (evidence: `pkg/runner/engine.go`)
- Scan runner → PoC repository: loads PoCs (evidence: `pkg/runner/engine.go`)
- Scan runner → HTTP client: executes checks (evidence: `pkg/runner/engine.go`)
- Fingerprinting → PoC model: uses PoCs (evidence: `pkg/fingerprint/engine.go`)
- PoC repository → PoC model: loads definitions (evidence: `pkg/pocsrepo/repo.go`)
- Built-in checks → PoC model: defines checks (evidence: `pocs/pocs.go`)
- PoC validation → PoC model: validates (evidence: `pkg/validator/validator.go`)
- Scan options → PoC repository: configures sources (evidence: `pkg/config/options.go`)
- CLI → Curated PoCs: mounts curated PoCs (evidence: `cmd/afrog/main.go`)
- Curated PoCs → Curated service API: uses client (evidence: `pkg/curated/service/service.go`)
- Curated service API → Curated service: requests content
- Go application → Go SDK: embeds scanner (evidence: `README.md`)
- Go SDK → Scan runner: runs scan (evidence: `pkg/sdk/scanner.go`)
- API client → gRPC API: submits scans (evidence: `README.md`)
- CLI → gRPC API: serves API (evidence: `cmd/afrog/main.go`)
- gRPC API → Task manager: delegates tasks (evidence: `pkg/scanapi/server.go`)
- Task manager → Scan runner: starts execution
- Web console → SQLite results: queries findings (evidence: `pkg/web/handlers.go`)
- Scan runner → Findings: produces findings (evidence: `pkg/runner/engine.go`)
- Scan runner → SQLite results: persists results (evidence: `pkg/runner/engine.go`)
- Findings → Reports: renders reports (evidence: `README.md`)
- CLI → Notifications: sends alerts (evidence: `cmd/afrog/main.go`)
