# sadeemurrahmon/sih26160-ipsec-vpn-analyzer architecture

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

- Interactive diagram: https://gitdiagram.com/sadeemurrahmon/sih26160-ipsec-vpn-analyzer
- Repository: https://github.com/sadeemurrahmon/sih26160-ipsec-vpn-analyzer

## Overview

This is an offline defensive IPsec VPN analyzer. Analysts provide a packet capture or session JSON; the Streamlit app parses captures and cleartext IKE, builds sessions, derives normalized features, and computes separate configuration-risk and behavioral-anomaly results. Dashboard views present packet details, risk explanations, a command center, and a timeline; the app also offers JSON and HTML reports. The sampled code supports the main capture and scoring flow. Timeline implementation was not sampled, so its internal behavior is not inferred.

Main entry points: [`app.py`](https://github.com/sadeemurrahmon/sih26160-ipsec-vpn-analyzer/blob/main/app.py) (Streamlit App), [`risk_analysis.py`](https://github.com/sadeemurrahmon/sih26160-ipsec-vpn-analyzer/blob/main/risk_analysis.py) (Risk Explanation), [`plotting.py`](https://github.com/sadeemurrahmon/sih26160-ipsec-vpn-analyzer/blob/main/plotting.py) (Plotting Helper), [`pcap_parser.py`](https://github.com/sadeemurrahmon/sih26160-ipsec-vpn-analyzer/blob/main/pcap_parser.py) (Capture Parser)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_input["Input Parsing"]
  node_app["Streamlit App<br/>[app.py]"]
  node_capture_parser["Capture Parser<br/>[pcap_parser.py]"]
  node_ike_parser["IKE Parser<br/>[ike_parser.py]"]
  node_sessions["Session Loader<br/>[session_loader.py]"]
end

subgraph group_analysis["Session Analysis"]
  node_features["Feature Engineering"]
  node_risk["Risk Rules<br/>[risk_engine.py]"]
  node_anomaly["Anomaly Detector"]
end

subgraph group_views["Dashboard Views"]
  node_overview["Command Center<br/>[overview.py]"]
  node_packet_view["Packet Analysis<br/>[packet_analysis.py]"]
  node_risk_view["Risk Explanation<br/>[risk_analysis.py]"]
  node_timeline["Timeline<br/>[timeline.py]"]
  node_plotting["Plotting Helper<br/>[plotting.py]"]
end

subgraph group_reporting["Reporting"]
  node_reports["JSON / HTML Reports<br/>[app.py]"]
end

node_analyst(("Analyst"))
node_capture["PCAP / pcapng"]
node_json_input["Session JSON"]

node_analyst -->|"selects input"| node_app
node_capture -->|"uploads or selects"| node_app
node_json_input -->|"uploads or selects"| node_app
node_app -->|"parses capture"| node_capture_parser
node_capture_parser -->|"parses IKE"| node_ike_parser
node_app -->|"builds sessions"| node_sessions
node_sessions -->|"decodes suites"| node_ike_parser
node_app -->|"adds features"| node_features
node_app -->|"scores behavior"| node_anomaly
node_app -->|"assesses risk"| node_risk
node_app -->|"renders view"| node_overview
node_app -->|"renders view"| node_packet_view
node_app -->|"renders view"| node_risk_view
node_app -->|"renders view"| node_timeline
node_risk_view -->|"reads baseline"| node_anomaly
node_overview -->|"displays charts"| node_plotting
node_packet_view -->|"displays charts"| node_plotting
node_risk_view -->|"displays charts"| node_plotting
node_app -->|"exports reports"| node_reports

click node_app "https://github.com/sadeemurrahmon/sih26160-ipsec-vpn-analyzer/blob/main/app.py"
click node_capture_parser "https://github.com/sadeemurrahmon/sih26160-ipsec-vpn-analyzer/blob/main/pcap_parser.py"
click node_ike_parser "https://github.com/sadeemurrahmon/sih26160-ipsec-vpn-analyzer/blob/main/ike_parser.py"
click node_sessions "https://github.com/sadeemurrahmon/sih26160-ipsec-vpn-analyzer/blob/main/session_loader.py"
click node_features "https://github.com/sadeemurrahmon/sih26160-ipsec-vpn-analyzer/blob/main/feature_engineering.py"
click node_risk "https://github.com/sadeemurrahmon/sih26160-ipsec-vpn-analyzer/blob/main/risk_engine.py"
click node_anomaly "https://github.com/sadeemurrahmon/sih26160-ipsec-vpn-analyzer/blob/main/anomaly_detector.py"
click node_overview "https://github.com/sadeemurrahmon/sih26160-ipsec-vpn-analyzer/blob/main/overview.py"
click node_packet_view "https://github.com/sadeemurrahmon/sih26160-ipsec-vpn-analyzer/blob/main/packet_analysis.py"
click node_risk_view "https://github.com/sadeemurrahmon/sih26160-ipsec-vpn-analyzer/blob/main/risk_analysis.py"
click node_timeline "https://github.com/sadeemurrahmon/sih26160-ipsec-vpn-analyzer/blob/main/timeline.py"
click node_plotting "https://github.com/sadeemurrahmon/sih26160-ipsec-vpn-analyzer/blob/main/plotting.py"
click node_reports "https://github.com/sadeemurrahmon/sih26160-ipsec-vpn-analyzer/blob/main/app.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_app,node_capture_parser,node_ike_parser,node_sessions toneBlue
class node_features,node_risk,node_anomaly toneAmber
class node_overview,node_packet_view,node_risk_view,node_timeline,node_plotting toneMint
class node_reports toneRose
class node_analyst,node_capture,node_json_input toneIndigo
```

## Components

### Input Parsing

- [Streamlit App](https://github.com/sadeemurrahmon/sih26160-ipsec-vpn-analyzer/blob/main/app.py): `app.py`
- [Capture Parser](https://github.com/sadeemurrahmon/sih26160-ipsec-vpn-analyzer/blob/main/pcap_parser.py): `pcap_parser.py`
- [IKE Parser](https://github.com/sadeemurrahmon/sih26160-ipsec-vpn-analyzer/blob/main/ike_parser.py): `ike_parser.py`
- [Session Loader](https://github.com/sadeemurrahmon/sih26160-ipsec-vpn-analyzer/blob/main/session_loader.py): `session_loader.py`

### Session Analysis

- [Feature Engineering](https://github.com/sadeemurrahmon/sih26160-ipsec-vpn-analyzer/blob/main/feature_engineering.py): `feature_engineering.py`
- [Risk Rules](https://github.com/sadeemurrahmon/sih26160-ipsec-vpn-analyzer/blob/main/risk_engine.py): `risk_engine.py`
- [Anomaly Detector](https://github.com/sadeemurrahmon/sih26160-ipsec-vpn-analyzer/blob/main/anomaly_detector.py): `anomaly_detector.py`

### Dashboard Views

- [Command Center](https://github.com/sadeemurrahmon/sih26160-ipsec-vpn-analyzer/blob/main/overview.py): `overview.py`
- [Packet Analysis](https://github.com/sadeemurrahmon/sih26160-ipsec-vpn-analyzer/blob/main/packet_analysis.py): `packet_analysis.py`
- [Risk Explanation](https://github.com/sadeemurrahmon/sih26160-ipsec-vpn-analyzer/blob/main/risk_analysis.py): `risk_analysis.py`
- [Timeline](https://github.com/sadeemurrahmon/sih26160-ipsec-vpn-analyzer/blob/main/timeline.py): `timeline.py`
- [Plotting Helper](https://github.com/sadeemurrahmon/sih26160-ipsec-vpn-analyzer/blob/main/plotting.py): `plotting.py`

### Reporting

- [JSON / HTML Reports](https://github.com/sadeemurrahmon/sih26160-ipsec-vpn-analyzer/blob/main/app.py): `app.py`

### Other components

- **Analyst**
- **PCAP / pcapng**
- **Session JSON**

## Connections

- Analyst → Streamlit App: selects input (evidence: `README.md`)
- PCAP / pcapng → Streamlit App: uploads or selects (evidence: `app.py`)
- Session JSON → Streamlit App: uploads or selects (evidence: `app.py`)
- Streamlit App → Capture Parser: parses capture (evidence: `app.py`)
- Capture Parser → IKE Parser: parses IKE (evidence: `pcap_parser.py`)
- Streamlit App → Session Loader: builds sessions (evidence: `app.py`)
- Session Loader → IKE Parser: decodes suites (evidence: `session_loader.py`)
- Streamlit App → Feature Engineering: adds features (evidence: `app.py`)
- Streamlit App → Anomaly Detector: scores behavior (evidence: `app.py`)
- Streamlit App → Risk Rules: assesses risk (evidence: `app.py`)
- Streamlit App → Command Center: renders view (evidence: `app.py`)
- Streamlit App → Packet Analysis: renders view (evidence: `app.py`)
- Streamlit App → Risk Explanation: renders view (evidence: `app.py`)
- Streamlit App → Timeline: renders view (evidence: `app.py`)
- Risk Explanation → Anomaly Detector: reads baseline (evidence: `risk_analysis.py`)
- Command Center → Plotting Helper: displays charts (evidence: `overview.py`)
- Packet Analysis → Plotting Helper: displays charts (evidence: `packet_analysis.py`)
- Risk Explanation → Plotting Helper: displays charts (evidence: `risk_analysis.py`)
- Streamlit App → JSON / HTML Reports: exports reports (evidence: `app.py`)
