# c0der0712/cns_project architecture

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

- Interactive diagram: https://gitdiagram.com/c0der0712/cns_project
- Repository: https://github.com/c0der0712/cns_project

## Overview

This is a TaCo traffic-classifier robustness study: the notebook prepares packet-capture flows and MFR inputs, trains or loads classifiers, runs packet-level attacks, and records study results. The local package implements that evaluation workflow and supporting analyses, including capture-disjoint and masked-identifier experiments, adversarial fine-tuning, probes, transfer, calibration, and shortcut/window analyses. Edges rely on README statements and the supplied source excerpts or SOURCE INDEX; unsampled notebook and module internals are not asserted beyond those references.

Main entry points: [`Robust_evaluation/robust/attacks.py`](https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/attacks.py) (Attack search), [`Robust_evaluation/robust/data_io.py`](https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/data_io.py) (Flow loading), [`Robust_evaluation/robust/suite.py`](https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/suite.py) (Attack suite), [`Robust_evaluation/robust/model_io.py`](https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/model_io.py) (Model objectives)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_study["Study workflow"]
  node_notebook["Experiment notebook<br/>[CNS_Project.ipynb]"]
  node_flowprep["Flow and MFR prep<br/>[CNS_Project.ipynb]"]
  node_training["Classifier training<br/>[CNS_Project.ipynb]"]
  node_results[("Study results")]
end

subgraph group_attack["Attack evaluation"]
  node_attacks["Attack search<br/>[attacks.py]"]
  node_suite["Attack suite<br/>[suite.py]"]
  node_eval["Attack evaluation<br/>[eval_attacks.py]"]
  node_defence["Adversarial fine-tuning<br/>[adv_finetune.py]"]
end

subgraph group_analysis["Robustness analyses"]
  node_capture["Capture-disjoint split"]
  node_masked["Masked dataset<br/>[mask_dataset.py]"]
  node_probe["Linear probes<br/>[linear_probe.py]"]
  node_paired["Paired comparison<br/>[paired_compare.py]"]
  node_calibration["Similarity calibration<br/>[rq1_calibration.py]"]
  node_foundation["Foundation transfer"]
  node_shortcut["Shortcut analysis"]
  node_windows["Window-group analysis<br/>[window_groups.py]"]
end

subgraph group_core["Evaluation core"]
  node_threat["Threat budgets<br/>[threat_model.py]"]
  node_flowdata["Flow loading<br/>[data_io.py]"]
  node_pcap["Packet edit operators<br/>[pcap_ops.py]"]
  node_features["MFR conversion<br/>[pipeline.py]"]
  node_masking["Identifier masking<br/>[masking.py]"]
  node_modelio["Model objectives<br/>[model_io.py]"]
  node_stats["Confidence statistics<br/>[stats.py]"]
end

node_researcher(("Researcher"))
node_iscx[("ISCXVPN captures")]
node_taco["TaCo models"]

node_researcher -->|"runs"| node_notebook
node_iscx -->|"provides captures"| node_flowprep
node_taco -->|"provides model code"| node_training
node_notebook -->|"prepares flows"| node_flowprep
node_notebook -->|"trains classifiers"| node_training
node_notebook -->|"runs evaluations"| node_eval
node_notebook -->|"writes outputs"| node_results
node_flowdata -->|"loads flows"| node_pcap
node_flowdata -->|"converts flows"| node_features
node_features -->|"reads flow structure"| node_pcap
node_features -->|"applies masks"| node_masking
node_attacks -->|"generates edits"| node_pcap
node_attacks -->|"scores MFRs"| node_features
node_attacks -->|"queries objectives"| node_modelio
node_attacks -->|"obeys budgets"| node_threat
node_suite -->|"dispatches attacks"| node_attacks
node_suite -->|"consumes items"| node_flowdata
node_suite -->|"builds objectives"| node_modelio
node_suite -->|"converts flows"| node_features
node_suite -->|"uses budgets"| node_threat
node_eval -->|"runs suite"| node_suite
node_eval -->|"summarizes outcomes"| node_stats
node_defence -->|"crafts training examples"| node_attacks
node_defence -->|"evaluates defense"| node_suite
node_defence -->|"uses objectives"| node_modelio
node_defence -->|"loads training flows"| node_flowdata
node_defence -->|"converts examples"| node_features
node_defence -->|"reports intervals"| node_stats
node_masked -->|"uses masking"| node_masking
node_probe -->|"uses models"| node_modelio
node_probe -->|"aggregates results"| node_stats
node_paired -->|"computes differences"| node_stats
node_calibration -->|"searches collisions"| node_attacks
node_calibration -->|"loads test flows"| node_flowdata
node_calibration -->|"evaluates embeddings"| node_modelio
node_calibration -->|"reports statistics"| node_stats
node_foundation -->|"crafts transfer attacks"| node_attacks
node_foundation -->|"loads flows"| node_flowdata
node_foundation -->|"evaluates models"| node_modelio
node_shortcut -->|"analyzes flows"| node_flowdata
node_shortcut -->|"examines models"| node_modelio
node_shortcut -->|"summarizes findings"| node_stats
node_windows -->|"groups flows"| node_flowdata
node_windows -->|"analyzes models"| node_modelio

click node_notebook "https://github.com/c0der0712/cns_project/blob/main/CNS_Project.ipynb"
click node_flowprep "https://github.com/c0der0712/cns_project/blob/main/CNS_Project.ipynb"
click node_training "https://github.com/c0der0712/cns_project/blob/main/CNS_Project.ipynb"
click node_results "https://github.com/c0der0712/cns_project/tree/main/Results"
click node_threat "https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/threat_model.py"
click node_flowdata "https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/data_io.py"
click node_pcap "https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/pcap_ops.py"
click node_features "https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/pipeline.py"
click node_masking "https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/masking.py"
click node_modelio "https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/model_io.py"
click node_attacks "https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/attacks.py"
click node_suite "https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/suite.py"
click node_eval "https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/eval_attacks.py"
click node_defence "https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/adv_finetune.py"
click node_stats "https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/stats.py"
click node_capture "https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/make_capture_split.py"
click node_masked "https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/mask_dataset.py"
click node_probe "https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/linear_probe.py"
click node_paired "https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/paired_compare.py"
click node_calibration "https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/rq1_calibration.py"
click node_foundation "https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/foundation_transfer.py"
click node_shortcut "https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/shortcut_analysis.py"
click node_windows "https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/window_groups.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_notebook,node_flowprep,node_training,node_results toneBlue
class node_attacks,node_suite,node_eval,node_defence,node_iscx toneAmber
class node_capture,node_masked,node_probe,node_paired,node_calibration,node_foundation,node_shortcut,node_windows toneMint
class node_threat,node_flowdata,node_pcap,node_features,node_masking,node_modelio,node_stats toneRose
class node_researcher,node_taco toneIndigo
```

## Components

### Study workflow

- [Experiment notebook](https://github.com/c0der0712/cns_project/blob/main/CNS_Project.ipynb): `CNS_Project.ipynb`
- [Flow and MFR prep](https://github.com/c0der0712/cns_project/blob/main/CNS_Project.ipynb): `CNS_Project.ipynb`
- [Classifier training](https://github.com/c0der0712/cns_project/blob/main/CNS_Project.ipynb): `CNS_Project.ipynb`
- [Study results](https://github.com/c0der0712/cns_project/tree/main/Results): `Results`

### Attack evaluation

- [Attack search](https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/attacks.py): `Robust_evaluation/robust/attacks.py`
- [Attack suite](https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/suite.py): `Robust_evaluation/robust/suite.py`
- [Attack evaluation](https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/eval_attacks.py): `Robust_evaluation/robust/eval_attacks.py`
- [Adversarial fine-tuning](https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/adv_finetune.py): `Robust_evaluation/robust/adv_finetune.py`

### Robustness analyses

- [Capture-disjoint split](https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/make_capture_split.py): `Robust_evaluation/robust/make_capture_split.py`
- [Masked dataset](https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/mask_dataset.py): `Robust_evaluation/robust/mask_dataset.py`
- [Linear probes](https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/linear_probe.py): `Robust_evaluation/robust/linear_probe.py`
- [Paired comparison](https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/paired_compare.py): `Robust_evaluation/robust/paired_compare.py`
- [Similarity calibration](https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/rq1_calibration.py): `Robust_evaluation/robust/rq1_calibration.py`
- [Foundation transfer](https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/foundation_transfer.py): `Robust_evaluation/robust/foundation_transfer.py`
- [Shortcut analysis](https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/shortcut_analysis.py): `Robust_evaluation/robust/shortcut_analysis.py`
- [Window-group analysis](https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/window_groups.py): `Robust_evaluation/robust/window_groups.py`

### Evaluation core

- [Threat budgets](https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/threat_model.py): `Robust_evaluation/robust/threat_model.py`
- [Flow loading](https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/data_io.py): `Robust_evaluation/robust/data_io.py`
- [Packet edit operators](https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/pcap_ops.py): `Robust_evaluation/robust/pcap_ops.py`
- [MFR conversion](https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/pipeline.py): `Robust_evaluation/robust/pipeline.py`
- [Identifier masking](https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/masking.py): `Robust_evaluation/robust/masking.py`
- [Model objectives](https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/model_io.py): `Robust_evaluation/robust/model_io.py`
- [Confidence statistics](https://github.com/c0der0712/cns_project/blob/main/Robust_evaluation/robust/stats.py): `Robust_evaluation/robust/stats.py`

### Other components

- **Researcher**
- **ISCXVPN captures**
- **TaCo models**

## Connections

- Researcher → Experiment notebook: runs (evidence: `README.md`)
- ISCXVPN captures → Flow and MFR prep: provides captures (evidence: `README.md`)
- TaCo models → Classifier training: provides model code (evidence: `README.md`)
- Experiment notebook → Flow and MFR prep: prepares flows (evidence: `README.md`)
- Experiment notebook → Classifier training: trains classifiers (evidence: `README.md`)
- Experiment notebook → Attack evaluation: runs evaluations (evidence: `README.md`)
- Experiment notebook → Study results: writes outputs (evidence: `README.md`)
- Flow loading → Packet edit operators: loads flows (evidence: `Robust_evaluation/robust/data_io.py`)
- Flow loading → MFR conversion: converts flows (evidence: `Robust_evaluation/robust/data_io.py`)
- MFR conversion → Packet edit operators: reads flow structure (evidence: `Robust_evaluation/robust/pipeline.py`)
- MFR conversion → Identifier masking: applies masks (evidence: `Robust_evaluation/robust/pipeline.py`)
- Attack search → Packet edit operators: generates edits (evidence: `Robust_evaluation/robust/attacks.py`)
- Attack search → MFR conversion: scores MFRs (evidence: `Robust_evaluation/robust/attacks.py`)
- Attack search → Model objectives: queries objectives (evidence: `Robust_evaluation/robust/attacks.py`)
- Attack search → Threat budgets: obeys budgets (evidence: `Robust_evaluation/robust/attacks.py`)
- Attack suite → Attack search: dispatches attacks (evidence: `Robust_evaluation/robust/suite.py`)
- Attack suite → Flow loading: consumes items (evidence: `Robust_evaluation/robust/suite.py`)
- Attack suite → Model objectives: builds objectives (evidence: `Robust_evaluation/robust/suite.py`)
- Attack suite → MFR conversion: converts flows (evidence: `Robust_evaluation/robust/suite.py`)
- Attack suite → Threat budgets: uses budgets (evidence: `Robust_evaluation/robust/suite.py`)
- Attack evaluation → Attack suite: runs suite (evidence: `Robust_evaluation/robust/eval_attacks.py`)
- Attack evaluation → Confidence statistics: summarizes outcomes (evidence: `Robust_evaluation/robust/eval_attacks.py`)
- Adversarial fine-tuning → Attack search: crafts training examples (evidence: `Robust_evaluation/robust/adv_finetune.py`)
- Adversarial fine-tuning → Attack suite: evaluates defense (evidence: `Robust_evaluation/robust/adv_finetune.py`)
- Adversarial fine-tuning → Model objectives: uses objectives (evidence: `Robust_evaluation/robust/adv_finetune.py`)
- Adversarial fine-tuning → Flow loading: loads training flows (evidence: `Robust_evaluation/robust/adv_finetune.py`)
- Adversarial fine-tuning → MFR conversion: converts examples (evidence: `Robust_evaluation/robust/adv_finetune.py`)
- Adversarial fine-tuning → Confidence statistics: reports intervals (evidence: `Robust_evaluation/robust/adv_finetune.py`)
- Masked dataset → Identifier masking: uses masking (evidence: `Robust_evaluation/robust/mask_dataset.py`)
- Linear probes → Model objectives: uses models (evidence: `Robust_evaluation/robust/linear_probe.py`)
- Linear probes → Confidence statistics: aggregates results (evidence: `Robust_evaluation/robust/linear_probe.py`)
- Paired comparison → Confidence statistics: computes differences (evidence: `Robust_evaluation/robust/paired_compare.py`)
- Similarity calibration → Attack search: searches collisions (evidence: `Robust_evaluation/robust/rq1_calibration.py`)
- Similarity calibration → Flow loading: loads test flows (evidence: `Robust_evaluation/robust/rq1_calibration.py`)
- Similarity calibration → Model objectives: evaluates embeddings (evidence: `Robust_evaluation/robust/rq1_calibration.py`)
- Similarity calibration → Confidence statistics: reports statistics (evidence: `Robust_evaluation/robust/rq1_calibration.py`)
- Foundation transfer → Attack search: crafts transfer attacks (evidence: `Robust_evaluation/robust/foundation_transfer.py`)
- Foundation transfer → Flow loading: loads flows (evidence: `Robust_evaluation/robust/foundation_transfer.py`)
- Foundation transfer → Model objectives: evaluates models (evidence: `Robust_evaluation/robust/foundation_transfer.py`)
- Shortcut analysis → Flow loading: analyzes flows (evidence: `Robust_evaluation/robust/shortcut_analysis.py`)
- Shortcut analysis → Model objectives: examines models (evidence: `Robust_evaluation/robust/shortcut_analysis.py`)
- Shortcut analysis → Confidence statistics: summarizes findings (evidence: `Robust_evaluation/robust/shortcut_analysis.py`)
- Window-group analysis → Flow loading: groups flows (evidence: `Robust_evaluation/robust/window_groups.py`)
- Window-group analysis → Model objectives: analyzes models (evidence: `Robust_evaluation/robust/window_groups.py`)
