# hatboy/pcap-analyzer architecture

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

- Interactive diagram: https://gitdiagram.com/hatboy/pcap-analyzer
- Repository: https://github.com/hatboy/pcap-analyzer

## Overview

Pcap-Analyzer is a Flask web application for uploading packet captures and inspecting, analyzing, and extracting information from them. The documented workflow proceeds from upload to packet details, protocol and traffic analysis, then optional session/file extraction and security warnings; IP geolocation is another analysis view. The backend relationships below are supported by the route module’s indexed references and excerpts, while feature coverage also follows the README. The bundled ECharts runtime is represented as a visualization capability; its precise connection to application routes is not shown in the supplied excerpts.

Main entry points: [`app/views.py`](https://github.com/hatboy/pcap-analyzer/blob/master/app/views.py) (Web routes), [`app/static/echarts-2.27/src/echarts.js`](https://github.com/hatboy/pcap-analyzer/blob/master/app/static/echarts-2.27/src/echarts.js) (Interactive charts), [`app/utils/file_extract.py`](https://github.com/hatboy/pcap-analyzer/blob/master/app/utils/file_extract.py) (File extraction), [`app/utils/data_extract.py`](https://github.com/hatboy/pcap-analyzer/blob/master/app/utils/data_extract.py) (Session extraction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_flask["Flask app<br/>[__init__.py]"]
  node_forms["Upload/filter forms<br/>[forms.py]"]
  node_routes["Web routes<br/>[views.py]"]
end

subgraph group_analysis["Packet analysis"]
  node_upload["Upload handling<br/>[upload_tools.py]"]
  node_decode["Packet decoding<br/>[pcap_decode.py]"]
  node_filter["Protocol filtering<br/>[pcap_filter.py]"]
  node_protocol["Protocol analysis<br/>[proto_analyzer.py]"]
  node_traffic["Traffic analysis<br/>[flow_analyzer.py]"]
  node_geolocation["IP geolocation<br/>[ipmap_tools.py]"]
end

subgraph group_extract["Extraction and security"]
  node_sessions["Session extraction<br/>[data_extract.py]"]
  node_fileextract["File extraction<br/>[file_extract.py]"]
  node_risk["Risk detection<br/>[except_info.py]"]
end

subgraph group_visual["Visualization"]
  node_charts["Interactive charts<br/>[echarts.js]"]
  node_chartcomponents["Chart components<br/>[component.js]"]
  node_chartconfig["Chart defaults<br/>[config.js]"]
end

node_user(("Analyst"))

node_user -->|"uses"| node_routes
node_flask -->|"registers"| node_routes
node_routes -->|"uses"| node_forms
node_routes -->|"calls"| node_upload
node_routes -->|"calls"| node_decode
node_routes -->|"calls"| node_filter
node_routes -->|"calls"| node_protocol
node_routes -->|"calls"| node_traffic
node_routes -->|"calls"| node_geolocation
node_routes -->|"calls"| node_sessions
node_routes -->|"calls"| node_fileextract
node_routes -->|"calls"| node_risk
node_fileextract -->|"uses"| node_sessions
node_charts -->|"loads"| node_chartcomponents
node_charts -->|"loads"| node_chartconfig
node_routes -.->|"renders results"| node_charts

click node_flask "https://github.com/hatboy/pcap-analyzer/blob/master/app/__init__.py"
click node_forms "https://github.com/hatboy/pcap-analyzer/blob/master/app/forms.py"
click node_routes "https://github.com/hatboy/pcap-analyzer/blob/master/app/views.py"
click node_upload "https://github.com/hatboy/pcap-analyzer/blob/master/app/utils/upload_tools.py"
click node_decode "https://github.com/hatboy/pcap-analyzer/blob/master/app/utils/pcap_decode.py"
click node_filter "https://github.com/hatboy/pcap-analyzer/blob/master/app/utils/pcap_filter.py"
click node_protocol "https://github.com/hatboy/pcap-analyzer/blob/master/app/utils/proto_analyzer.py"
click node_traffic "https://github.com/hatboy/pcap-analyzer/blob/master/app/utils/flow_analyzer.py"
click node_geolocation "https://github.com/hatboy/pcap-analyzer/blob/master/app/utils/ipmap_tools.py"
click node_sessions "https://github.com/hatboy/pcap-analyzer/blob/master/app/utils/data_extract.py"
click node_fileextract "https://github.com/hatboy/pcap-analyzer/blob/master/app/utils/file_extract.py"
click node_risk "https://github.com/hatboy/pcap-analyzer/blob/master/app/utils/except_info.py"
click node_charts "https://github.com/hatboy/pcap-analyzer/blob/master/app/static/echarts-2.27/src/echarts.js"
click node_chartcomponents "https://github.com/hatboy/pcap-analyzer/blob/master/app/static/echarts-2.27/src/component.js"
click node_chartconfig "https://github.com/hatboy/pcap-analyzer/blob/master/app/static/echarts-2.27/src/config.js"

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_flask,node_forms,node_routes toneBlue
class node_upload,node_decode,node_filter,node_protocol,node_traffic,node_geolocation toneAmber
class node_sessions,node_fileextract,node_risk toneMint
class node_charts,node_chartcomponents,node_chartconfig toneRose
class node_user toneIndigo
```

## Components

### Web interface

- [Flask app](https://github.com/hatboy/pcap-analyzer/blob/master/app/__init__.py): `app/__init__.py`
- [Upload/filter forms](https://github.com/hatboy/pcap-analyzer/blob/master/app/forms.py): `app/forms.py`
- [Web routes](https://github.com/hatboy/pcap-analyzer/blob/master/app/views.py): `app/views.py`

### Packet analysis

- [Upload handling](https://github.com/hatboy/pcap-analyzer/blob/master/app/utils/upload_tools.py): `app/utils/upload_tools.py`
- [Packet decoding](https://github.com/hatboy/pcap-analyzer/blob/master/app/utils/pcap_decode.py): `app/utils/pcap_decode.py`
- [Protocol filtering](https://github.com/hatboy/pcap-analyzer/blob/master/app/utils/pcap_filter.py): `app/utils/pcap_filter.py`
- [Protocol analysis](https://github.com/hatboy/pcap-analyzer/blob/master/app/utils/proto_analyzer.py): `app/utils/proto_analyzer.py`
- [Traffic analysis](https://github.com/hatboy/pcap-analyzer/blob/master/app/utils/flow_analyzer.py): `app/utils/flow_analyzer.py`
- [IP geolocation](https://github.com/hatboy/pcap-analyzer/blob/master/app/utils/ipmap_tools.py): `app/utils/ipmap_tools.py`

### Extraction and security

- [Session extraction](https://github.com/hatboy/pcap-analyzer/blob/master/app/utils/data_extract.py): `app/utils/data_extract.py`
- [File extraction](https://github.com/hatboy/pcap-analyzer/blob/master/app/utils/file_extract.py): `app/utils/file_extract.py`
- [Risk detection](https://github.com/hatboy/pcap-analyzer/blob/master/app/utils/except_info.py): `app/utils/except_info.py`

### Visualization

- [Interactive charts](https://github.com/hatboy/pcap-analyzer/blob/master/app/static/echarts-2.27/src/echarts.js): `app/static/echarts-2.27/src/echarts.js`
- [Chart components](https://github.com/hatboy/pcap-analyzer/blob/master/app/static/echarts-2.27/src/component.js): `app/static/echarts-2.27/src/component.js`
- [Chart defaults](https://github.com/hatboy/pcap-analyzer/blob/master/app/static/echarts-2.27/src/config.js): `app/static/echarts-2.27/src/config.js`

### Other components

- **Analyst**

## Connections

- Analyst → Web routes: uses
- Flask app → Web routes: registers (evidence: `app/__init__.py`)
- Web routes → Upload/filter forms: uses (evidence: `app/views.py`)
- Web routes → Upload handling: calls (evidence: `app/views.py`)
- Web routes → Packet decoding: calls (evidence: `app/views.py`)
- Web routes → Protocol filtering: calls (evidence: `app/views.py`)
- Web routes → Protocol analysis: calls (evidence: `app/views.py`)
- Web routes → Traffic analysis: calls (evidence: `app/views.py`)
- Web routes → IP geolocation: calls (evidence: `app/views.py`)
- Web routes → Session extraction: calls (evidence: `app/views.py`)
- Web routes → File extraction: calls (evidence: `app/views.py`)
- Web routes → Risk detection: calls (evidence: `app/views.py`)
- File extraction → Session extraction: uses (evidence: `app/utils/file_extract.py`)
- Interactive charts → Chart components: loads (evidence: `app/static/echarts-2.27/src/echarts.js`)
- Interactive charts → Chart defaults: loads (evidence: `app/static/echarts-2.27/src/echarts.js`)
- Web routes → Interactive charts: renders results
