# subhajit-garai/minor_project-kgec_25-27- architecture

> Architecture diagram of the GitHub repository subhajit-garai/minor_project-kgec_25-27-, 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/subhajit-garai/minor_project-kgec_25-27-
- Repository: https://github.com/subhajit-garai/minor_project-kgec_25-27-

## Overview

This repository is principally a Python deep-packet-inspection (DPI) prototype: live or PCAP traffic is captured, converted into packet features, aggregated into bidirectional flows, and classified by a saved decision-tree model. The main demonstrated entry point is `dpi/main.py`; capture wrappers and CSV export are additional capture capabilities. The web app appears to be an uncustomized Next.js scaffold, with no evidenced connection to DPI. The README provides no further capability details, and unsampled modules are not inferred beyond indexed references.

Main entry points: [`dpi/main.py`](https://github.com/subhajit-garai/minor_project-kgec_25-27-/blob/main/dpi/main.py) (DPI runner), [`dpi/capture/packet_capture.py`](https://github.com/subhajit-garai/minor_project-kgec_25-27-/blob/main/dpi/capture/packet_capture.py) (Capture engine), [`dpi/model/prediction_engine.py`](https://github.com/subhajit-garai/minor_project-kgec_25-27-/blob/main/dpi/model/prediction_engine.py) (Prediction engine), [`dpi/flow/flow_manager.py`](https://github.com/subhajit-garai/minor_project-kgec_25-27-/blob/main/dpi/flow/flow_manager.py) (Flow manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Packet capture"]
  node_capture["Capture engine<br/>[packet_capture.py]"]
  node_live_wrapper["Live capture wrapper<br/>[livecapture.py]"]
  node_writer["Packet CSV writer<br/>[packet_writer.py]"]
end

subgraph group_analysis["Traffic analysis"]
  node_extractor["Packet feature extractor"]
  node_flow_manager["Flow manager<br/>[flow_manager.py]"]
  node_flow["Bidirectional flow<br/>[flow.py]"]
end

subgraph group_classification["ML classification"]
  node_predict_adapter["Model setup<br/>[predict.py]"]
  node_engine["Prediction engine"]
  node_model_files["Decision-tree artifacts"]
end

subgraph group_support["Runtime support"]
  node_main["DPI runner<br/>[main.py]"]
  node_logger["Application logger<br/>[logger.py]"]
end

node_operator(("Operator"))
node_network(("Live interface"))
node_pcap["PCAP file"]
node_csv["CSV output"]
node_web_shell["Web scaffold<br/>[page.tsx]"]

node_operator -->|"starts"| node_main
node_main -->|"starts capture"| node_capture
node_main -->|"provides extractor"| node_extractor
node_main -->|"aggregates packets"| node_flow_manager
node_main -->|"loads classifier"| node_predict_adapter
node_main -->|"logs packets"| node_logger
node_network -->|"supplies packets"| node_capture
node_pcap -->|"supplies packets"| node_capture
node_capture -->|"extracts features"| node_extractor
node_capture -->|"writes features"| node_writer
node_capture -->|"calls callback"| node_main
node_live_wrapper -->|"delegates capture"| node_capture
node_capture -->|"writes CSV"| node_csv
node_flow_manager -->|"updates flow"| node_flow
node_flow_manager -->|"gets flow key"| node_extractor
node_predict_adapter -->|"initializes engine"| node_engine
node_predict_adapter -->|"loads artifacts"| node_model_files
node_engine -->|"loads model"| node_model_files
node_main -->|"predicts flow"| node_engine
node_engine -->|"extracts statistics"| node_flow

click node_main "https://github.com/subhajit-garai/minor_project-kgec_25-27-/blob/main/dpi/main.py"
click node_capture "https://github.com/subhajit-garai/minor_project-kgec_25-27-/blob/main/dpi/capture/packet_capture.py"
click node_live_wrapper "https://github.com/subhajit-garai/minor_project-kgec_25-27-/blob/main/dpi/capture/livecapture.py"
click node_extractor "https://github.com/subhajit-garai/minor_project-kgec_25-27-/blob/main/dpi/feature/feature_extractor.py"
click node_writer "https://github.com/subhajit-garai/minor_project-kgec_25-27-/blob/main/dpi/capture/packet_writer.py"
click node_flow_manager "https://github.com/subhajit-garai/minor_project-kgec_25-27-/blob/main/dpi/flow/flow_manager.py"
click node_flow "https://github.com/subhajit-garai/minor_project-kgec_25-27-/blob/main/dpi/flow/flow.py"
click node_predict_adapter "https://github.com/subhajit-garai/minor_project-kgec_25-27-/blob/main/dpi/model/predict.py"
click node_engine "https://github.com/subhajit-garai/minor_project-kgec_25-27-/blob/main/dpi/model/prediction_engine.py"
click node_model_files "https://github.com/subhajit-garai/minor_project-kgec_25-27-/tree/main/dpi/model/saved/DT"
click node_logger "https://github.com/subhajit-garai/minor_project-kgec_25-27-/blob/main/dpi/utils/logger.py"
click node_web_shell "https://github.com/subhajit-garai/minor_project-kgec_25-27-/blob/main/apps/web/app/page.tsx"

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_capture,node_live_wrapper,node_writer toneBlue
class node_extractor,node_flow_manager,node_flow toneAmber
class node_predict_adapter,node_engine,node_model_files toneMint
class node_main,node_logger toneRose
class node_operator,node_network,node_pcap,node_csv toneIndigo
class node_web_shell toneTeal
```

## Components

### Packet capture

- [Capture engine](https://github.com/subhajit-garai/minor_project-kgec_25-27-/blob/main/dpi/capture/packet_capture.py): `dpi/capture/packet_capture.py`
- [Live capture wrapper](https://github.com/subhajit-garai/minor_project-kgec_25-27-/blob/main/dpi/capture/livecapture.py): `dpi/capture/livecapture.py`
- [Packet CSV writer](https://github.com/subhajit-garai/minor_project-kgec_25-27-/blob/main/dpi/capture/packet_writer.py): `dpi/capture/packet_writer.py`

### Traffic analysis

- [Packet feature extractor](https://github.com/subhajit-garai/minor_project-kgec_25-27-/blob/main/dpi/feature/feature_extractor.py): `dpi/feature/feature_extractor.py`
- [Flow manager](https://github.com/subhajit-garai/minor_project-kgec_25-27-/blob/main/dpi/flow/flow_manager.py): `dpi/flow/flow_manager.py`
- [Bidirectional flow](https://github.com/subhajit-garai/minor_project-kgec_25-27-/blob/main/dpi/flow/flow.py): `dpi/flow/flow.py`

### ML classification

- [Model setup](https://github.com/subhajit-garai/minor_project-kgec_25-27-/blob/main/dpi/model/predict.py): `dpi/model/predict.py`
- [Prediction engine](https://github.com/subhajit-garai/minor_project-kgec_25-27-/blob/main/dpi/model/prediction_engine.py): `dpi/model/prediction_engine.py`
- [Decision-tree artifacts](https://github.com/subhajit-garai/minor_project-kgec_25-27-/tree/main/dpi/model/saved/DT): `dpi/model/saved/DT`

### Runtime support

- [DPI runner](https://github.com/subhajit-garai/minor_project-kgec_25-27-/blob/main/dpi/main.py): `dpi/main.py`
- [Application logger](https://github.com/subhajit-garai/minor_project-kgec_25-27-/blob/main/dpi/utils/logger.py): `dpi/utils/logger.py`

### Other components

- **Operator**
- **Live interface**
- **PCAP file**
- **CSV output**
- [Web scaffold](https://github.com/subhajit-garai/minor_project-kgec_25-27-/blob/main/apps/web/app/page.tsx): `apps/web/app/page.tsx`

## Connections

- Operator → DPI runner: starts (evidence: `dpi/main.py`)
- DPI runner → Capture engine: starts capture (evidence: `dpi/main.py`)
- DPI runner → Packet feature extractor: provides extractor (evidence: `dpi/main.py`)
- DPI runner → Flow manager: aggregates packets (evidence: `dpi/main.py`)
- DPI runner → Model setup: loads classifier (evidence: `dpi/main.py`)
- DPI runner → Application logger: logs packets (evidence: `dpi/main.py`)
- Live interface → Capture engine: supplies packets (evidence: `dpi/capture/packet_capture.py`)
- PCAP file → Capture engine: supplies packets (evidence: `dpi/capture/packet_capture.py`)
- Capture engine → Packet feature extractor: extracts features (evidence: `dpi/capture/packet_capture.py`)
- Capture engine → Packet CSV writer: writes features (evidence: `dpi/capture/packet_capture.py`)
- Capture engine → DPI runner: calls callback (evidence: `dpi/main.py`)
- Live capture wrapper → Capture engine: delegates capture (evidence: `dpi/capture/livecapture.py`)
- Capture engine → CSV output: writes CSV (evidence: `dpi/capture/packet_capture.py`)
- Flow manager → Bidirectional flow: updates flow (evidence: `dpi/flow/flow_manager.py`)
- Flow manager → Packet feature extractor: gets flow key (evidence: `dpi/flow/flow_manager.py`)
- Model setup → Prediction engine: initializes engine (evidence: `dpi/model/predict.py`)
- Model setup → Decision-tree artifacts: loads artifacts (evidence: `dpi/model/predict.py`)
- Prediction engine → Decision-tree artifacts: loads model (evidence: `dpi/model/prediction_engine.py`)
- DPI runner → Prediction engine: predicts flow (evidence: `dpi/main.py`)
- Prediction engine → Bidirectional flow: extracts statistics (evidence: `dpi/model/prediction_engine.py`)
