Comprehensive TCP congestion window monitoring and analysis toolkit using eBPF for kernel-level monitoring with advanced filtering, visualization, and reporting capabilities.
- Real-time eBPF monitoring of TCP CWND directly from kernel (kprobe on
tcp_rcv_established) - Unified command interface through single
./run.shscript - Session-based organization with automatic timestamped folders
- Advanced filtering by PID, addresses, ports, CWND ranges
- Multiple chart types (timeline, connections, heatmap, overview)
- Interactive HTML reports with Plotly visualization
- Comprehensive HTML analysis reports with embedded charts and statistics
- Live monitoring with real-time updates
- Multiple report formats (text, JSON, HTML)
- Automatic session management with cleanup functionality
- Historical analysis of previously collected data
- Automatic permission handling for seamless operation
- Linux with eBPF support (kernel >= 5.x recommended)
- Root/sudo privileges (for eBPF monitoring)
- Python 3.8+
git clone https://github.com/LordPrinz/dzajtcper.git
cd dzajtcper
chmod +x install.sh
./install.shinstall.sh automatically:
- Detects your distribution (Debian/Ubuntu, Fedora, CentOS/RHEL, Arch)
- Installs system packages:
bpfcc-tools,python3-bpfcc,linux-headers,python3-venv - Creates a Python virtual environment with
--system-site-packages(required for BCC access) - Installs Python dependencies (
pandas,matplotlib,seaborn,plotly) into the venv - Makes all scripts executable
Note: If you previously ran
install.sh, running it again will automatically recreate the virtual environment from scratch to ensure a clean state.
./uninstall.shRemoves the Python virtual environment. Optionally removes generated output data (out/). System packages (BCC, etc.) are NOT removed automatically.
chmod +x install.sh
./install.sh./run.sh monitor --duration 30 # Automatically handles sudo
./run.sh analyze # Analyze latest session./run.sh quick --duration 60 # Monitor + analyze + generate HTML report automaticallyπ HTML Report Features:
- π Complete statistics (connections, processes, CWND analysis)
- π Embedded interactive charts
- π Connection analysis tables
- π‘ Per-process activity breakdown
- Location:
out/session_*/charts/tcp_analysis_*.html
./run.sh report # Generate HTML report from latest sessionAll TCP CWND data is automatically organized in session directories with unified structure:
out/
βββ session_20250911_143025/
β βββ cwnd_log.csv # π Raw TCP monitoring data
β βββ charts/
β β βββ chart_20250911_143225_timeline.png # π Timeline chart
β β βββ chart_20250911_143225_connections.png # π Connection analysis
β β βββ chart_20250911_143225_heatmap.png # π‘οΈ Traffic heatmap
β β βββ chart_20250911_143225_timeline_interactive.html # π― Interactive charts
β β βββ tcp_analysis_20250911_143225.html # π Comprehensive HTML report
β βββ analysis_20250911_145030/ # π Alternative analysis folder
β βββ chart_20250911_145030_timeline.png # π Filtered analysis
β βββ chart_20250911_145030_connections.png # π Filtered analysis
βββ session_20250911_145123/
β βββ cwnd_log.csv # π Session with data only
βββ session_20250911_150245/
βββ cwnd_log.csv # π Raw data
βββ charts/ # π Quick analysis charts + HTML report
βββ analysis_*_... # π Additional analysis files
# List all sessions with data summary
./run.sh list
# Clean up empty session directories
./run.sh clean# Monitor indefinitely (Ctrl+C to stop)
./run.sh monitor
# Monitor for specific duration
./run.sh monitor --duration 300# Analyze latest session automatically
./run.sh analyze
# Analyze specific session
./run.sh analyze session_20250911_143025
# List available sessions
./run.sh list
# Clean empty sessions
./run.sh clean# Filter by destination port (HTTPS traffic)
./run.sh analyze --dport 443 --charts timeline connections
# Filter by source port (SSH traffic)
./run.sh analyze --sport 22 --charts heatmap
# Filter by PID (specific process)
./run.sh analyze --pid 1234 --charts timeline
# Filter by IP addresses
./run.sh analyze --saddr 192.168.1.100 --daddr 10.0.0.1
# Filter by CWND range
./run.sh analyze --cwnd-min 10 --cwnd-max 100
# Combine multiple filters
./run.sh analyze --dport 443 --cwnd-min 20 --charts timeline connections# Generate specific chart types
./run.sh analyze --charts timeline # Only timeline
./run.sh analyze --charts connections # Only connections
./run.sh analyze --charts heatmap # Only heatmap
./run.sh analyze --charts overview # Only overview
./run.sh analyze --charts timeline connections heatmap # Multiple
# All charts (default behavior when no --charts specified)
./run.sh analyze# Quick monitoring: collect data + analyze + generate charts + HTML report
./run.sh quick --duration 60
# What Quick Start does:
# 1. Monitors TCP connections for specified duration (default: 60s)
# 2. Automatically analyzes collected data
# 3. Generates overview charts (timeline, connections, heatmap)
# 4. Creates comprehensive HTML analysis report in charts folder
# 5. Shows quick statistics summary# Comprehensive HTML report
./run.sh report
# Report from specific session
./run.sh report session_20250911_143025
# Report with custom output name
./run.sh report session_20250911_143025 custom_analysis.html
# Quick monitoring with immediate report
./run.sh quick --duration 30 && ./run.sh report# Live monitoring of latest session
./run.sh live
# Live monitoring for specific duration
./run.sh live --duration 60| Command | Description | Example |
|---|---|---|
monitor |
Start eBPF monitoring | ./run.sh monitor --duration 60 |
analyze |
Analyze existing data | ./run.sh analyze --dport 443 |
live |
Live monitoring dashboard | ./run.sh live --duration 60 |
quick |
Monitor + analyze + charts + HTML report | ./run.sh quick --duration 30 |
report |
Generate comprehensive report | ./run.sh report |
list |
List all sessions | ./run.sh list |
clean |
Clean empty sessions | ./run.sh clean |
| Option | Type | Description | Example |
|---|---|---|---|
--duration |
int | Monitoring duration in seconds | --duration 300 |
--help |
flag | Show command help | ./run.sh --help |
| Option | Type | Description | Example |
|---|---|---|---|
--pid |
int | Filter by process ID | --pid 1234 |
--saddr |
string | Source address pattern | --saddr 192.168.1.* |
--daddr |
string | Destination address pattern | --daddr 10.0.0.1 |
--sport |
int | Source port | --sport 22 |
--dport |
int | Destination port | --dport 443 |
--cwnd-min |
int | Minimum CWND value | --cwnd-min 10 |
--cwnd-max |
int | Maximum CWND value | --cwnd-max 100 |
| Chart Type | Description | Use Case |
|---|---|---|
timeline |
CWND evolution over time | Overall performance analysis |
connections |
Per-connection statistics | Connection comparison |
heatmap |
Activity intensity map | Pattern identification |
overview |
Summary statistics | Quick overview |
| Format | Description | Use Case |
|---|---|---|
| HTML | Rich formatted report with embedded charts | Detailed analysis and presentation |
| Text | Plain text summary | Quick review |
| JSON | Machine readable data | Automation/scripting |
The virtual environment is missing or was created incorrectly. Re-run install:
./install.shThis will remove the old venv and create a fresh one with all dependencies.
# run.sh automatically handles sudo for monitoring commands
./run.sh monitor --duration 60 # Handles sudo automatically
./run.sh analyze # Handles file permissions automatically# Check if there's active TCP traffic
ss -tuln
# Use longer monitoring duration
./run.sh monitor --duration 120
# Generate some traffic
curl https://example.com# Ensure kernel headers are installed
sudo apt install linux-headers-$(uname -r)
# Verify BCC is working
sudo python3 -c "from bcc import BPF; print('BCC OK')"# Clean up empty sessions
./run.sh clean
# Check if monitoring collected data
./run.sh listIf ./run.sh shows "Virtual environment not found!":
./install.sh # Creates/recreates the venv- Short analysis: 15-30 seconds monitoring
- Performance testing: 2-5 minutes monitoring
- Long-term analysis: 10+ minutes monitoring
- Live monitoring: Use with active network traffic
- Large datasets: Use filters to focus analysis
# Monitor during load test
./run.sh monitor --duration 300
# Analyze HTTP traffic
./run.sh analyze --dport 80 --charts timeline connections
# Generate comprehensive report
./run.sh report# Monitor SSH activity
./run.sh monitor --duration 120
# Analyze SSH connections
./run.sh analyze --sport 22 --charts connections heatmap# Monitor database traffic
./run.sh monitor --duration 180
# Analyze MySQL connections
./run.sh analyze --dport 3306
# Generate MySQL analysis report
./run.sh report# Find application PID
pgrep nginx
# Monitor and analyze application traffic
./run.sh quick --duration 60
./run.sh analyze --pid 1234 --charts timeline connectionsdzajtcper/
βββ run.sh # π― Unified command interface (uses venv Python)
βββ tcp_monitor.py # π§ CLI engine / orchestrator
βββ tcp_cwnd_monitor.py # π¬ eBPF kprobe script (kernel-level tracing)
βββ src/ # π¦ Core modules
β βββ data_loader.py # π Data loading and validation
β βββ data_filter.py # π Advanced filtering capabilities
β βββ visualizer.py # π Chart generation (matplotlib, seaborn, plotly)
β βββ monitor.py # π‘ Live monitoring functionality
β βββ reporter.py # π Report generation (text, JSON, HTML)
β βββ log_manager.py # π Session management
βββ docs/ # π Documentation
β βββ QUICK_START.md # π Quick start guide
β βββ CHEAT_SHEET.md # β‘ Command cheat sheet
βββ out/ # πΎ Session data storage (generated)
βββ venv/ # π Python virtual environment (generated)
βββ install.sh # βοΈ Installation script
βββ uninstall.sh # ποΈ Uninstallation script
βββ requirements.txt # π Python pip dependencies
βββ README.md # π This documentation
install.shinstalls system BCC packages and creates a Python venv with--system-site-packagesso that both pip packages (pandas, matplotlib...) and system BCC are accessiblerun.shresolves the venv Python interpreter and uses it for all commands; handles sudo for monitoringtcp_cwnd_monitor.pyattaches a kprobe totcp_rcv_establishedvia eBPF, readssnd_cwndfromstruct tcp_sock, and sends events via perf buffertcp_monitor.pyorchestrates monitoring sessions, analysis, chart generation, and reportingsrc/modules handle data loading, filtering, visualization, live monitoring, and report generation
-
Session Manager (
src/log_manager.py)- Automatic session creation with timestamps
- Empty session cleanup
- Session listing and selection
-
DataLoader (
src/data_loader.py)- CSV data loading and validation
- Connection string creation
- Data integrity checks
-
DataFilter (
src/data_filter.py)- Method chaining for complex filters
- PID, address, port, CWND range filtering
- Time-based and connection-based filtering
-
ChartGenerator (
src/visualizer.py)- Timeline plots with high-contrast colors
- Connection analysis charts
- Activity heatmaps
- Interactive HTML charts (Plotly)
-
ReportGenerator (
src/reporter.py)- Comprehensive analysis reports
- Multiple output formats (text, JSON, HTML)
- Performance metrics calculation
- OS: Linux with eBPF support (kernel >= 5.x recommended, 4.x supported)
- Privileges: Root/sudo for eBPF monitoring
- Python: 3.8+
- System packages:
bpfcc-tools,python3-bpfcc,linux-headers,python3-venv - Python packages (installed automatically by
install.sh):pandas,matplotlib,seaborn,plotly
- docs/QUICK_START.md - Complete guide to HTML reports and quick analysis
- docs/CHEAT_SHEET.md - Command reference and examples
MIT License - see LICENSE file for details.