A Flask-based network traffic analyzer that captures packets with Tshark, extracts DNS and TLS SNI domains, classifies app usage with multi-signal rules, detects anomalies, and visualizes insights in a modern dashboard.
- Captures traffic from a user-selected interface (from Tshark interface list).
- Parses DNS query names and TLS SNI hostnames from a PCAP file.
- Uses multi-signal app detection with:
- domain patterns
- destination port hints
- frequency-based refinement for repeated unknown domains
- Groups and classifies traffic into categories such as Streaming, Social Media, Messaging, Browsing, Shopping, Cloud/Work, and System/Infra.
- Generates behavior summaries and anomaly alerts.
- Computes a session Threat Score with Safe / Moderate / Risky levels.
- Tracks device-wise behavior summaries.
- Shows protocol distribution (HTTP, HTTPS, DNS, TCP, UDP).
- Provides live graphs (Chart.js):
- Requests per second
- Domains per second
- Protocol usage over time
- Shows Top Apps Used (table + bar chart).
- Produces downloadable CSV and PDF reports.
- Python 3.11+
- Flask (web backend)
- Tshark (packet capture and protocol field extraction)
- Matplotlib (bar and pie charts)
- Chart.js (live and app charts)
- ReportLab (PDF report generation)
- HTML/CSS/JavaScript (dashboard UI)
app.py: Flask app, routes, capture lifecycle, history, API endpoints.analyzer.py: packet/domain extraction, classification, threat scoring, chart generation.templates/index.html: dashboard layout.static/style.css: UI styling.static/app.js: live dashboard polling and updates.captures/latest_capture.pcap: latest capture file.captures/history.json: recent run history.requirements.txt: Python dependencies.
- Install Python 3.11 or later.
- Install Wireshark (includes Tshark):
- Make sure Tshark is available in PATH, or installed in a standard location.
- On Windows, run terminal as Administrator for packet capture access.
pip install -r requirements.txtpython app.pyOpen:
- Select capture interface and duration (or manual stop).
- Click Start Capture.
- Generate traffic (open websites/apps).
- Click Stop Capture and Analyze.
- Review top domains/apps, categories, device behavior, threat score, alerts, and charts.
- Optionally download CSV or PDF report.
GET /api/live: live packet/hit totals, rates, protocol stats, and top apps/domains.GET /api/interfaces: available capture interfaces and selected interface.
- Capturing on a client Wi-Fi adapter usually shows mostly local-device traffic, not full traffic of all devices on the same Wi-Fi.
- On WPA2/WPA3 networks, per-device unicast traffic is encrypted and often not visible from another client machine.
- Domain extraction relies on DNS/TLS visibility; encrypted DNS or missing SNI can reduce visibility.
- Classification quality depends on domain rule coverage.
- Threat score and intrusion outputs are heuristic indicators, not definitive attack proof.
- Error:
tshark was not found... - Fix: install Wireshark/Tshark and ensure PATH is correct.
- Run terminal as Administrator on Windows.
- The app now handles common partial/corrupt capture read cases more gracefully.
- Start a fresh capture if analysis data is empty or inconsistent.
- Some traffic may not expose DNS/SNI fields (DoH/DoT, QUIC patterns, cache hits).
- Try longer capture duration and generate diverse web traffic.
- Install dependencies again:
pip install -r requirements.txt - Ensure
reportlabis installed in the active Python environment.
Educational/demo project.