Packet Analyzer is an offline C++17 network traffic analysis and filtering tool. It reads a .pcap capture, parses Ethernet, IPv4, TCP, UDP, ICMP, DNS, HTTP, TLS SNI, and common application traffic, applies optional blocking rules, writes a filtered PCAP, and generates JSON, CSV, and HTML dashboard reports.
The project is intentionally dependency-light: it builds with CMake and a C++17 compiler only.
- PCAP file reader for Ethernet captures.
- Packet parser for Ethernet, IPv4, TCP, UDP, and ICMP metadata.
- Deep packet inspection for:
- TLS Client Hello Server Name Indication.
- HTTP Host headers.
- DNS query names.
- Port-based fallback for HTTPS, HTTP, DNS, QUIC, SSH, SMTP, and other services.
- Flow tracking with the five-tuple: source IP, destination IP, source port, destination port, and protocol.
- Blocking rules for IP addresses, applications, domains, and destination ports.
- Filtered PCAP output containing only allowed packets.
- JSON report for automation and integrations.
- CSV flow report for spreadsheet analysis.
- Self-contained HTML dashboard report.
- Standalone browser UI at
ui/index.htmlfor loading generated JSON reports. - GitHub Actions workflow for Linux, Windows, and macOS CMake smoke tests.
.
|-- include/ Header files for parser and DPI helpers
|-- src/ C++ source files
|-- rules/ Example blocking rules
|-- ui/ Browser-based JSON report viewer
|-- about/ In-depth concept documentation
|-- workflow/ End-to-end workflow and command guide
|-- .github/workflows/ CI build and smoke test workflow
|-- CMakeLists.txt Build configuration
|-- generate_test_pcap.py Creates a synthetic test PCAP
|-- test_dpi.pcap Sample traffic used by the smoke test
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config ReleaseMeaning:
cmake -S . -B buildconfigures the project from the current folder and places generated build files inbuild.-DCMAKE_BUILD_TYPE=Releaserequests an optimized release build for single-config generators.cmake --build build --config Releasecompiles thepacket_analyzerexecutable.
On Windows, the executable is usually:
build\Release\packet_analyzer.exe
On Linux/macOS, the executable is usually:
build/packet_analyzer
Analyze the included sample capture:
./build/packet_analyzer analyze test_dpi.pcapWindows PowerShell:
.\build\Release\packet_analyzer.exe analyze test_dpi.pcapDefault outputs:
reports/filtered.pcap
reports/analysis.json
reports/flows.csv
reports/dashboard.html
Block YouTube by detected application:
./build/packet_analyzer analyze test_dpi.pcap --block-app YouTubeBlock TikTok domains:
./build/packet_analyzer analyze test_dpi.pcap --block-domain "*.tiktok.com"Use the sample rules file:
./build/packet_analyzer analyze test_dpi.pcap --rules rules/sample_rules.txtWrite custom output paths:
./build/packet_analyzer analyze test_dpi.pcap \
--output reports/allowed.pcap \
--json reports/analysis.json \
--csv reports/flows.csv \
--html reports/dashboard.htmlThere are two UI options:
- Open
reports/dashboard.htmlafter running the analyzer. - Open
ui/index.html, then choosereports/analysis.jsonfrom the file picker.
The UI supports searching flows, filtering by verdict, viewing app distribution, checking top domains, and inspecting block reasons or risk indicators.
ctest --test-dir build --build-config Release --output-on-failureMeaning:
ctestruns the configured CMake tests.--test-dir buildtells CTest to use the generated build folder.--build-config Releaseselects the Release executable on multi-config generators such as Visual Studio.--output-on-failureprints analyzer logs if the smoke test fails.
- Start with about/README.md for the concepts used in the project.
- Use workflow/END_TO_END_WORKFLOW.md for the complete build, run, report, and CI workflow.
- Use workflow/COMMAND_REFERENCE.md for command-by-command meanings.
- This is an offline PCAP analyzer. It does not capture live network traffic by itself.
- TLS payload content remains encrypted. The analyzer only inspects visible metadata such as SNI, HTTP Host, DNS query names, packet headers, and ports.
- Modern encrypted Client Hello can hide SNI. In that case the analyzer falls back to ports and flow metadata.