# sammothxc/spiderfoot-ng architecture

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

- Interactive diagram: https://gitdiagram.com/sammothxc/spiderfoot-ng
- Repository: https://github.com/sammothxc/spiderfoot-ng

## Overview

SpiderFoot-ng is an OSINT scanning application: a user supplies a target through the web UI or CLI, selects scan modules, and explores stored findings and exports. Its central runtime is the scan controller coordinating event-driven plugins; results are persisted in SQLite and can be viewed, queried, correlated, and exported. The README also documents profiles, a live network graph, TOR support, and optional external tools. Some feature links below rely on README descriptions because their implementation was not sampled.

Main entry points: [`modules`](https://github.com/sammothxc/spiderfoot-ng/tree/master/modules) (OSINT Modules), [`sfwebui.py`](https://github.com/sammothxc/spiderfoot-ng/blob/master/sfwebui.py) (Web UI), [`sfscan.py`](https://github.com/sammothxc/spiderfoot-ng/blob/master/sfscan.py) (Scan Controller), [`sf.py`](https://github.com/sammothxc/spiderfoot-ng/blob/master/sf.py) (Application Entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User Interfaces"]
  node_web["Web UI<br/>[sfwebui.py]"]
  node_cli["CLI<br/>[sfcli.py]"]
  node_entrypoint["Application Entry<br/>[sf.py]"]
  node_profiles["Scan Profiles<br/>[sfwebui.py]"]
end

subgraph group_runtime["Scan Runtime"]
  node_scan["Scan Controller<br/>[sfscan.py]"]
  node_events["Event Bus<br/>[event.py]"]
  node_plugin["Plugin Runtime<br/>[plugin.py]"]
  node_threadpool["Thread Pool<br/>[threadpool.py]"]
end

subgraph group_modules["OSINT Collection"]
  node_collectors["OSINT Modules"]
  node_dns["DNS Discovery<br/>[sfp_dnsresolve.py]"]
  node_intel["Threat Intelligence<br/>[sfp_alienvault.py]"]
  node_darkweb["Dark Web Search"]
end

subgraph group_analysis["Analysis and Results"]
  node_correlator["Correlation Engine<br/>[correlation.py]"]
  node_database[("SQLite Store<br/>[db.py]")]
  node_results["Scan Results<br/>[sfwebui.py]"]
  node_exports["Data Exports<br/>[sfwebui.py]"]
  node_networkgraph["Live Network Graph<br/>[viz.js]"]
end

subgraph group_platform["Runtime Services"]
  node_tor(("TOR Network"))
  node_externaltools["Optional CLI Tools"]
  node_helpers["Shared Helpers<br/>[sflib.py]"]
end

node_user(("Operator"))

node_user -->|"submits target"| node_web
node_user -->|"runs scans"| node_cli
node_web -->|"starts scans"| node_scan
node_cli -.->|"invokes app"| node_entrypoint
node_entrypoint -->|"starts server"| node_web
node_entrypoint -->|"uses controller"| node_scan
node_scan -->|"initializes modules"| node_collectors
node_scan -->|"routes events"| node_events
node_plugin -->|"publishes events"| node_events
node_plugin -->|"uses workers"| node_threadpool
node_collectors -.->|"includes"| node_dns
node_collectors -.->|"includes"| node_intel
node_collectors -.->|"includes"| node_darkweb
node_collectors -.->|"searches via"| node_tor
node_collectors -.->|"can call"| node_externaltools
node_scan -.->|"stores findings"| node_database
node_web -->|"queries results"| node_database
node_web -.->|"configures selection"| node_profiles
node_web -.->|"shows findings"| node_results
node_web -.->|"exports data"| node_exports
node_results -.->|"streams findings"| node_networkgraph
node_database -->|"provides scan data"| node_correlator
node_correlator -.->|"derives correlations"| node_results
node_collectors -.->|"uses shared functions"| node_helpers

click node_web "https://github.com/sammothxc/spiderfoot-ng/blob/master/sfwebui.py"
click node_cli "https://github.com/sammothxc/spiderfoot-ng/blob/master/sfcli.py"
click node_entrypoint "https://github.com/sammothxc/spiderfoot-ng/blob/master/sf.py"
click node_scan "https://github.com/sammothxc/spiderfoot-ng/blob/master/sfscan.py"
click node_events "https://github.com/sammothxc/spiderfoot-ng/blob/master/spiderfoot/event.py"
click node_plugin "https://github.com/sammothxc/spiderfoot-ng/blob/master/spiderfoot/plugin.py"
click node_threadpool "https://github.com/sammothxc/spiderfoot-ng/blob/master/spiderfoot/threadpool.py"
click node_collectors "https://github.com/sammothxc/spiderfoot-ng/tree/master/modules"
click node_dns "https://github.com/sammothxc/spiderfoot-ng/blob/master/modules/sfp_dnsresolve.py"
click node_intel "https://github.com/sammothxc/spiderfoot-ng/blob/master/modules/sfp_alienvault.py"
click node_darkweb "https://github.com/sammothxc/spiderfoot-ng/blob/master/modules/sfp_onionsearchengine.py"
click node_correlator "https://github.com/sammothxc/spiderfoot-ng/blob/master/spiderfoot/correlation.py"
click node_database "https://github.com/sammothxc/spiderfoot-ng/blob/master/spiderfoot/db.py"
click node_results "https://github.com/sammothxc/spiderfoot-ng/blob/master/sfwebui.py"
click node_exports "https://github.com/sammothxc/spiderfoot-ng/blob/master/sfwebui.py"
click node_profiles "https://github.com/sammothxc/spiderfoot-ng/blob/master/sfwebui.py"
click node_networkgraph "https://github.com/sammothxc/spiderfoot-ng/blob/master/spiderfoot/static/js/viz.js"
click node_helpers "https://github.com/sammothxc/spiderfoot-ng/blob/master/sflib.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_web,node_cli,node_entrypoint,node_profiles toneBlue
class node_scan,node_events,node_plugin,node_threadpool toneAmber
class node_collectors,node_dns,node_intel,node_darkweb toneMint
class node_correlator,node_database,node_results,node_exports,node_networkgraph toneRose
class node_tor,node_externaltools,node_helpers,node_user toneIndigo
```

## Components

### User Interfaces

- [Web UI](https://github.com/sammothxc/spiderfoot-ng/blob/master/sfwebui.py): `sfwebui.py`
- [CLI](https://github.com/sammothxc/spiderfoot-ng/blob/master/sfcli.py): `sfcli.py`
- [Application Entry](https://github.com/sammothxc/spiderfoot-ng/blob/master/sf.py): `sf.py`
- [Scan Profiles](https://github.com/sammothxc/spiderfoot-ng/blob/master/sfwebui.py): `sfwebui.py`

### Scan Runtime

- [Scan Controller](https://github.com/sammothxc/spiderfoot-ng/blob/master/sfscan.py): `sfscan.py`
- [Event Bus](https://github.com/sammothxc/spiderfoot-ng/blob/master/spiderfoot/event.py): `spiderfoot/event.py`
- [Plugin Runtime](https://github.com/sammothxc/spiderfoot-ng/blob/master/spiderfoot/plugin.py): `spiderfoot/plugin.py`
- [Thread Pool](https://github.com/sammothxc/spiderfoot-ng/blob/master/spiderfoot/threadpool.py): `spiderfoot/threadpool.py`

### OSINT Collection

- [OSINT Modules](https://github.com/sammothxc/spiderfoot-ng/tree/master/modules): `modules`
- [DNS Discovery](https://github.com/sammothxc/spiderfoot-ng/blob/master/modules/sfp_dnsresolve.py): `modules/sfp_dnsresolve.py`
- [Threat Intelligence](https://github.com/sammothxc/spiderfoot-ng/blob/master/modules/sfp_alienvault.py): `modules/sfp_alienvault.py`
- [Dark Web Search](https://github.com/sammothxc/spiderfoot-ng/blob/master/modules/sfp_onionsearchengine.py): `modules/sfp_onionsearchengine.py`

### Analysis and Results

- [Correlation Engine](https://github.com/sammothxc/spiderfoot-ng/blob/master/spiderfoot/correlation.py): `spiderfoot/correlation.py`
- [SQLite Store](https://github.com/sammothxc/spiderfoot-ng/blob/master/spiderfoot/db.py): `spiderfoot/db.py`
- [Scan Results](https://github.com/sammothxc/spiderfoot-ng/blob/master/sfwebui.py): `sfwebui.py`
- [Data Exports](https://github.com/sammothxc/spiderfoot-ng/blob/master/sfwebui.py): `sfwebui.py`
- [Live Network Graph](https://github.com/sammothxc/spiderfoot-ng/blob/master/spiderfoot/static/js/viz.js): `spiderfoot/static/js/viz.js`

### Runtime Services

- **TOR Network**
- **Optional CLI Tools**
- [Shared Helpers](https://github.com/sammothxc/spiderfoot-ng/blob/master/sflib.py): `sflib.py`

### Other components

- **Operator**

## Connections

- Operator → Web UI: submits target (evidence: `README.md`)
- Operator → CLI: runs scans (evidence: `README.md`)
- Web UI → Scan Controller: starts scans (evidence: `sfwebui.py`)
- CLI → Application Entry: invokes app (evidence: `README.md`)
- Application Entry → Web UI: starts server (evidence: `sf.py`)
- Application Entry → Scan Controller: uses controller (evidence: `sf.py`)
- Scan Controller → OSINT Modules: initializes modules (evidence: `sfscan.py`)
- Scan Controller → Event Bus: routes events (evidence: `sfscan.py`)
- Plugin Runtime → Event Bus: publishes events (evidence: `spiderfoot/plugin.py`)
- Plugin Runtime → Thread Pool: uses workers (evidence: `spiderfoot/plugin.py`)
- OSINT Modules → DNS Discovery: includes
- OSINT Modules → Threat Intelligence: includes
- OSINT Modules → Dark Web Search: includes
- OSINT Modules → TOR Network: searches via (evidence: `README.md`)
- OSINT Modules → Optional CLI Tools: can call (evidence: `README.md`)
- Scan Controller → SQLite Store: stores findings (evidence: `README.md`)
- Web UI → SQLite Store: queries results (evidence: `sfwebui.py`)
- Web UI → Scan Profiles: configures selection (evidence: `README.md`)
- Web UI → Scan Results: shows findings (evidence: `README.md`)
- Web UI → Data Exports: exports data (evidence: `README.md`)
- Scan Results → Live Network Graph: streams findings (evidence: `README.md`)
- SQLite Store → Correlation Engine: provides scan data (evidence: `spiderfoot/correlation.py`)
- Correlation Engine → Scan Results: derives correlations (evidence: `README.md`)
- OSINT Modules → Shared Helpers: uses shared functions
