# padigeltejas/snf-core architecture

> Architecture diagram of the GitHub repository padigeltejas/snf-core, 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/padigeltejas/snf-core
- Repository: https://github.com/padigeltejas/snf-core

## Overview

SNF-Core is an offline passive network fingerprinting engine: it replays PCAPs or captures live traffic, tracks flows, analyzes protocol metadata, and writes forensic NDJSON. The principal runtime path is capture through worker processing, flow and protocol analysis, then event output. Configuration, deterministic replay, and live reporting are supporting capabilities. The README documents the overall architecture; source excerpts confirm selected processing and analyzer calls, while unsampled implementation details are shown only where documented.

Main entry points: [`src/pipeline/packet_pipeline.rs`](https://github.com/padigeltejas/snf-core/blob/main/src/pipeline/packet_pipeline.rs) (Packet pipeline), [`src/main.rs`](https://github.com/padigeltejas/snf-core/blob/main/src/main.rs) (CLI launcher), [`src/capture/mod.rs`](https://github.com/padigeltejas/snf-core/blob/main/src/capture/mod.rs) (Capture engine), [`src/analyzers`](https://github.com/padigeltejas/snf-core/tree/main/src/analyzers) (Protocol analyzers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime and Capture"]
  node_launcher["CLI launcher<br/>[main.rs]"]
  node_config["Engine config<br/>[engine_config.rs]"]
  node_capture["Capture engine<br/>[mod.rs]"]
  node_workers["Worker pool<br/>[worker_pool.rs]"]
end

subgraph group_processing["Packet Processing"]
  node_pipeline["Packet pipeline<br/>[packet_pipeline.rs]"]
  node_context["Packet context<br/>[packet_context.rs]"]
  node_reassembly["TCP reassembly<br/>[tcp_reassembly.rs]"]
  node_manager["Analyzer manager<br/>[mod.rs]"]
end

subgraph group_analysis["Protocol Intelligence"]
  node_protocols["Protocol analyzers"]
  node_datasets[("Fingerprint datasets")]
end

subgraph group_state["State and Determinism"]
  node_flows[("Flow table<br/>[flow_table.rs]")]
  node_dns_cache[("DNS attribution cache<br/>[dns_cache.rs]")]
  node_determinism["Determinism checks<br/>[mod.rs]"]
end

subgraph group_results["Events and Results"]
  node_events["Event bus<br/>[event_bus.rs]"]
  node_serializer["NDJSON writer<br/>[ndjson_writer.rs]"]
  node_reporting["Live reporting<br/>[mod.rs]"]
end

node_operator(("Operator / capture"))
node_ndjson["NDJSON output"]

node_operator -->|"selects mode"| node_launcher
node_launcher -->|"builds config"| node_config
node_launcher -->|"starts capture"| node_capture
node_capture -->|"routes packets"| node_workers
node_workers -->|"processes packets"| node_pipeline
node_pipeline -->|"updates flows"| node_flows
node_pipeline -->|"dispatches analysis"| node_manager
node_manager -->|"invokes analyzers"| node_protocols
node_pipeline -.->|"populates context"| node_context
node_pipeline -->|"reassembles TCP"| node_reassembly
node_protocols -->|"attributes domains"| node_dns_cache
node_protocols -.->|"uses fingerprints"| node_datasets
node_pipeline -->|"emits events"| node_events
node_events -->|"serializes events"| node_serializer
node_serializer -->|"writes output"| node_ndjson
node_capture -->|"supports replay checks"| node_determinism
node_pipeline -.->|"updates live stats"| node_reporting

click node_launcher "https://github.com/padigeltejas/snf-core/blob/main/src/main.rs"
click node_config "https://github.com/padigeltejas/snf-core/blob/main/src/config/engine_config.rs"
click node_capture "https://github.com/padigeltejas/snf-core/blob/main/src/capture/mod.rs"
click node_workers "https://github.com/padigeltejas/snf-core/blob/main/src/threading/worker_pool.rs"
click node_pipeline "https://github.com/padigeltejas/snf-core/blob/main/src/pipeline/packet_pipeline.rs"
click node_context "https://github.com/padigeltejas/snf-core/blob/main/src/core/packet_context.rs"
click node_reassembly "https://github.com/padigeltejas/snf-core/blob/main/src/pipeline/tcp_reassembly.rs"
click node_flows "https://github.com/padigeltejas/snf-core/blob/main/src/flow/flow_table.rs"
click node_manager "https://github.com/padigeltejas/snf-core/blob/main/src/core/analyzer_manager/mod.rs"
click node_protocols "https://github.com/padigeltejas/snf-core/tree/main/src/analyzers"
click node_dns_cache "https://github.com/padigeltejas/snf-core/blob/main/src/discovery/dns_cache.rs"
click node_datasets "https://github.com/padigeltejas/snf-core/tree/main/src/dataset"
click node_determinism "https://github.com/padigeltejas/snf-core/blob/main/src/determinism/mod.rs"
click node_events "https://github.com/padigeltejas/snf-core/blob/main/src/core/event_bus.rs"
click node_serializer "https://github.com/padigeltejas/snf-core/blob/main/src/output/ndjson_writer.rs"
click node_reporting "https://github.com/padigeltejas/snf-core/blob/main/src/reporting/mod.rs"

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_launcher,node_config,node_capture,node_workers toneBlue
class node_pipeline,node_context,node_reassembly,node_manager toneAmber
class node_protocols,node_datasets toneMint
class node_flows,node_dns_cache,node_determinism toneRose
class node_events,node_serializer,node_reporting,node_operator,node_ndjson toneIndigo
```

## Components

### Runtime and Capture

- [CLI launcher](https://github.com/padigeltejas/snf-core/blob/main/src/main.rs): `src/main.rs`
- [Engine config](https://github.com/padigeltejas/snf-core/blob/main/src/config/engine_config.rs): `src/config/engine_config.rs`
- [Capture engine](https://github.com/padigeltejas/snf-core/blob/main/src/capture/mod.rs): `src/capture/mod.rs`
- [Worker pool](https://github.com/padigeltejas/snf-core/blob/main/src/threading/worker_pool.rs): `src/threading/worker_pool.rs`

### Packet Processing

- [Packet pipeline](https://github.com/padigeltejas/snf-core/blob/main/src/pipeline/packet_pipeline.rs): `src/pipeline/packet_pipeline.rs`
- [Packet context](https://github.com/padigeltejas/snf-core/blob/main/src/core/packet_context.rs): `src/core/packet_context.rs`
- [TCP reassembly](https://github.com/padigeltejas/snf-core/blob/main/src/pipeline/tcp_reassembly.rs): `src/pipeline/tcp_reassembly.rs`
- [Analyzer manager](https://github.com/padigeltejas/snf-core/blob/main/src/core/analyzer_manager/mod.rs): `src/core/analyzer_manager/mod.rs`

### Protocol Intelligence

- [Protocol analyzers](https://github.com/padigeltejas/snf-core/tree/main/src/analyzers): `src/analyzers`
- [Fingerprint datasets](https://github.com/padigeltejas/snf-core/tree/main/src/dataset): `src/dataset`

### State and Determinism

- [Flow table](https://github.com/padigeltejas/snf-core/blob/main/src/flow/flow_table.rs): `src/flow/flow_table.rs`
- [DNS attribution cache](https://github.com/padigeltejas/snf-core/blob/main/src/discovery/dns_cache.rs): `src/discovery/dns_cache.rs`
- [Determinism checks](https://github.com/padigeltejas/snf-core/blob/main/src/determinism/mod.rs): `src/determinism/mod.rs`

### Events and Results

- [Event bus](https://github.com/padigeltejas/snf-core/blob/main/src/core/event_bus.rs): `src/core/event_bus.rs`
- [NDJSON writer](https://github.com/padigeltejas/snf-core/blob/main/src/output/ndjson_writer.rs): `src/output/ndjson_writer.rs`
- [Live reporting](https://github.com/padigeltejas/snf-core/blob/main/src/reporting/mod.rs): `src/reporting/mod.rs`

### Other components

- **Operator / capture**
- **NDJSON output**

## Connections

- Operator / capture → CLI launcher: selects mode
- CLI launcher → Engine config: builds config (evidence: `src/main.rs`)
- CLI launcher → Capture engine: starts capture (evidence: `src/main.rs`)
- Capture engine → Worker pool: routes packets
- Worker pool → Packet pipeline: processes packets (evidence: `src/threading/worker_pool.rs`)
- Packet pipeline → Flow table: updates flows (evidence: `src/pipeline/packet_pipeline.rs`)
- Packet pipeline → Analyzer manager: dispatches analysis (evidence: `src/pipeline/packet_pipeline.rs`)
- Analyzer manager → Protocol analyzers: invokes analyzers (evidence: `src/core/analyzer_manager/mod.rs`)
- Packet pipeline → Packet context: populates context (evidence: `src/pipeline/packet_pipeline.rs`)
- Packet pipeline → TCP reassembly: reassembles TCP (evidence: `src/pipeline/packet_pipeline.rs`)
- Protocol analyzers → DNS attribution cache: attributes domains (evidence: `src/analyzers/tls.rs`)
- Protocol analyzers → Fingerprint datasets: uses fingerprints
- Packet pipeline → Event bus: emits events (evidence: `src/pipeline/packet_pipeline.rs`)
- Event bus → NDJSON writer: serializes events (evidence: `src/output/ndjson_writer.rs`)
- NDJSON writer → NDJSON output: writes output
- Capture engine → Determinism checks: supports replay checks (evidence: `src/determinism/mod.rs`)
- Packet pipeline → Live reporting: updates live stats
