# sarseej-shrestha/packetsentry architecture

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

- Interactive diagram: https://gitdiagram.com/sarseej-shrestha/packetsentry
- Repository: https://github.com/sarseej-shrestha/packetsentry

## Overview

PacketSentry is an offline educational experiment comparing supervised attack classification with unsupervised anomaly detection on fictional traffic. A user runs the CLI, which invokes the lab workflow; the workflow generates data, evaluates models, and writes results and a report. The workflow excerpt is incomplete, so the documented calibration, clustering, feature-importance, and visualization capabilities are represented without assuming unshown implementation details.

Main entry points: [`packetsentry/workflow.py`](https://github.com/sarseej-shrestha/packetsentry/blob/feature/packetsentry-deliverables/packetsentry/workflow.py) (Lab workflow), [`main.py`](https://github.com/sarseej-shrestha/packetsentry/blob/feature/packetsentry-deliverables/main.py) (CLI runner), [`packetsentry/data.py`](https://github.com/sarseej-shrestha/packetsentry/blob/feature/packetsentry-deliverables/packetsentry/data.py) (Traffic generator), [`outputs/synthetic_traffic.csv`](https://github.com/sarseej-shrestha/packetsentry/blob/feature/packetsentry-deliverables/outputs/synthetic_traffic.csv) (Synthetic traffic)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Experiment entry"]
  node_cli["CLI runner<br/>[main.py]"]
  node_workflow["Lab workflow<br/>[workflow.py]"]
end

subgraph group_data["Synthetic data"]
  node_generator["Traffic generator<br/>[data.py]"]
  node_dataset["Synthetic traffic"]
end

subgraph group_analysis["Model analysis"]
  node_split["Train/test split<br/>[workflow.py]"]
  node_supervised["Attack classification<br/>[workflow.py]"]
  node_tuning["Tuning and calibration<br/>[workflow.py]"]
  node_anomaly["Anomaly detection<br/>[workflow.py]"]
  node_clusters["Traffic clustering<br/>[workflow.py]"]
  node_projection["PCA projection<br/>[workflow.py]"]
  node_importance["Feature importance<br/>[workflow.py]"]
end

subgraph group_results["Results"]
  node_metrics["Evaluation metrics<br/>[workflow.py]"]
  node_artifacts["Experiment outputs"]
  node_report["Results report<br/>[report.md]"]
end

node_user(("User"))

node_user -->|"runs"| node_cli
node_cli -->|"invokes"| node_workflow
node_workflow -->|"generates"| node_generator
node_generator -->|"returns data"| node_workflow
node_workflow -->|"writes"| node_dataset
node_workflow -->|"splits data"| node_split
node_workflow -->|"fits and evaluates"| node_supervised
node_workflow -->|"tunes and calibrates"| node_tuning
node_workflow -->|"fits and evaluates"| node_anomaly
node_workflow -->|"clusters training data"| node_clusters
node_workflow -->|"projects test data"| node_projection
node_workflow -->|"measures importance"| node_importance
node_workflow -->|"computes"| node_metrics
node_workflow -->|"writes results"| node_artifacts
node_workflow -->|"writes report"| node_report
node_supervised -->|"evaluates predictions"| node_metrics
node_anomaly -->|"evaluates flags"| node_metrics

click node_cli "https://github.com/sarseej-shrestha/packetsentry/blob/feature/packetsentry-deliverables/main.py"
click node_workflow "https://github.com/sarseej-shrestha/packetsentry/blob/feature/packetsentry-deliverables/packetsentry/workflow.py"
click node_generator "https://github.com/sarseej-shrestha/packetsentry/blob/feature/packetsentry-deliverables/packetsentry/data.py"
click node_dataset "https://github.com/sarseej-shrestha/packetsentry/blob/feature/packetsentry-deliverables/outputs/synthetic_traffic.csv"
click node_split "https://github.com/sarseej-shrestha/packetsentry/blob/feature/packetsentry-deliverables/packetsentry/workflow.py"
click node_supervised "https://github.com/sarseej-shrestha/packetsentry/blob/feature/packetsentry-deliverables/packetsentry/workflow.py"
click node_tuning "https://github.com/sarseej-shrestha/packetsentry/blob/feature/packetsentry-deliverables/packetsentry/workflow.py"
click node_anomaly "https://github.com/sarseej-shrestha/packetsentry/blob/feature/packetsentry-deliverables/packetsentry/workflow.py"
click node_clusters "https://github.com/sarseej-shrestha/packetsentry/blob/feature/packetsentry-deliverables/packetsentry/workflow.py"
click node_projection "https://github.com/sarseej-shrestha/packetsentry/blob/feature/packetsentry-deliverables/packetsentry/workflow.py"
click node_importance "https://github.com/sarseej-shrestha/packetsentry/blob/feature/packetsentry-deliverables/packetsentry/workflow.py"
click node_metrics "https://github.com/sarseej-shrestha/packetsentry/blob/feature/packetsentry-deliverables/packetsentry/workflow.py"
click node_artifacts "https://github.com/sarseej-shrestha/packetsentry/tree/feature/packetsentry-deliverables/outputs"
click node_report "https://github.com/sarseej-shrestha/packetsentry/blob/feature/packetsentry-deliverables/outputs/report.md"

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_workflow,node_user toneBlue
class node_generator,node_dataset toneAmber
class node_split,node_supervised,node_tuning,node_anomaly,node_clusters,node_projection,node_importance toneMint
class node_metrics,node_artifacts,node_report toneRose
```

## Components

### Experiment entry

- [CLI runner](https://github.com/sarseej-shrestha/packetsentry/blob/feature/packetsentry-deliverables/main.py): `main.py`
- [Lab workflow](https://github.com/sarseej-shrestha/packetsentry/blob/feature/packetsentry-deliverables/packetsentry/workflow.py): `packetsentry/workflow.py`

### Synthetic data

- [Traffic generator](https://github.com/sarseej-shrestha/packetsentry/blob/feature/packetsentry-deliverables/packetsentry/data.py): `packetsentry/data.py`
- [Synthetic traffic](https://github.com/sarseej-shrestha/packetsentry/blob/feature/packetsentry-deliverables/outputs/synthetic_traffic.csv): `outputs/synthetic_traffic.csv`

### Model analysis

- [Train/test split](https://github.com/sarseej-shrestha/packetsentry/blob/feature/packetsentry-deliverables/packetsentry/workflow.py): `packetsentry/workflow.py`
- [Attack classification](https://github.com/sarseej-shrestha/packetsentry/blob/feature/packetsentry-deliverables/packetsentry/workflow.py): `packetsentry/workflow.py`
- [Tuning and calibration](https://github.com/sarseej-shrestha/packetsentry/blob/feature/packetsentry-deliverables/packetsentry/workflow.py): `packetsentry/workflow.py`
- [Anomaly detection](https://github.com/sarseej-shrestha/packetsentry/blob/feature/packetsentry-deliverables/packetsentry/workflow.py): `packetsentry/workflow.py`
- [Traffic clustering](https://github.com/sarseej-shrestha/packetsentry/blob/feature/packetsentry-deliverables/packetsentry/workflow.py): `packetsentry/workflow.py`
- [PCA projection](https://github.com/sarseej-shrestha/packetsentry/blob/feature/packetsentry-deliverables/packetsentry/workflow.py): `packetsentry/workflow.py`
- [Feature importance](https://github.com/sarseej-shrestha/packetsentry/blob/feature/packetsentry-deliverables/packetsentry/workflow.py): `packetsentry/workflow.py`

### Results

- [Evaluation metrics](https://github.com/sarseej-shrestha/packetsentry/blob/feature/packetsentry-deliverables/packetsentry/workflow.py): `packetsentry/workflow.py`
- [Experiment outputs](https://github.com/sarseej-shrestha/packetsentry/tree/feature/packetsentry-deliverables/outputs): `outputs`
- [Results report](https://github.com/sarseej-shrestha/packetsentry/blob/feature/packetsentry-deliverables/outputs/report.md): `outputs/report.md`

### Other components

- **User**

## Connections

- User → CLI runner: runs
- CLI runner → Lab workflow: invokes
- Lab workflow → Traffic generator: generates
- Traffic generator → Lab workflow: returns data
- Lab workflow → Synthetic traffic: writes
- Lab workflow → Train/test split: splits data
- Lab workflow → Attack classification: fits and evaluates
- Lab workflow → Tuning and calibration: tunes and calibrates
- Lab workflow → Anomaly detection: fits and evaluates
- Lab workflow → Traffic clustering: clusters training data
- Lab workflow → PCA projection: projects test data
- Lab workflow → Feature importance: measures importance
- Lab workflow → Evaluation metrics: computes
- Lab workflow → Experiment outputs: writes results
- Lab workflow → Results report: writes report
- Attack classification → Evaluation metrics: evaluates predictions
- Anomaly detection → Evaluation metrics: evaluates flags
