$ show GyulyVGC/sniffnet
Sniffnet is a cross-platform desktop GUI application for real-time network traffic monitoring and analysis, written in Rust using the Iced framework. It captures packets via pcap (live or from PCAP files) and also supports IPFIX flow collection over UDP. The application parses Ethernet, IP, TCP/UDP, ICMP, IGMP, ARP, and VLAN headers using a dedicated packet-parser library. It enriches captured traffic with geolocation (MaxMind GeoLite2 and IPinfo MMDB databases), ASN lookups, service identification (from a port-to-service map derived from nmap-services), and local process identification (via the listeners crate). The GUI provides multiple pages: an overview with live traffic charts and donut charts, an inspect page with a filterable and sortable connection table, a notifications page for alerts (thresholds, favorites, IP blacklists), and settings pages for themes, filters, and export. The application supports 25 languages, custom themes, and thumbnail mode for minimal monitoring. It is packaged for Linux (deb, rpm, AppImage), macOS (dmg), and Windows (msi), with CI/CD pipelines for cross-compilation and code signing.
The LLM identified 5 files worth highlighting for reuse:
A standalone Rust crate for parsing network packets at the link, network, and transport layers. It supports Ethernet, IPv4, IPv6, TCP, UDP, ICMPv4/v6, IGMP, ARP, and VLAN headers, with multiple link types (Ethernet, NULL, RAW, Linux SLL). The crate is fully independent, with its own Cargo.toml, CHANGELOG, and README, making it directly reusable in any Rust project requiring low-level packet inspection.
Implements a TtlMap (time-to-live hash map) for tracking baseline values of cumulative IPFIX counters. It enables efficient delta computation by storing the last seen value and a timestamp, automatically expiring stale entries. This pattern is reusable for any system that needs to convert cumulative counters into per-interval deltas, such as network flow monitoring or IoT sensor data.
Defines the Palette and PaletteExtension types for the application's theming system. It supports multiple color roles (primary, secondary, background, surface, etc.), gradient types (linear, radial, conic), and alpha channel handling. The palette can be loaded from TOML files or built-in themes, and is used to generate Iced style catalogs for all widgets. This component demonstrates a clean, extensible approach to theming that could be adapted for other Iced applications.
Provides the ErrorLogger trait and a location! macro for consistent error reporting across the codebase. In debug builds, errors trigger panics with detailed context; in release builds, they are logged to stderr. This pattern ensures that unexpected conditions are surfaced during development while remaining graceful in production. The trait is minimal and could be extracted as a small utility crate.
Implements ChartSeries, a data structure for managing time-series data used in traffic charts. It uses cosine-interpolated splines for smooth rendering and supports data reduction for offline periods (e.g., when the network interface is idle). The series can be updated incrementally and provides methods for querying values at arbitrary timestamps. This component is reusable for any real-time charting application requiring smooth interpolation and efficient memory usage.
The divergent implementation reorganizes the module structure by explicitly listing all pre-processor modules and their re-exports in a single file, while the typical implementation uses a more conventional Rust module organization with a `mod.rs` file that automatically discovers submodules. This is a structural difference in how the module system is organized rather than a functional improvement or degradation. The behavior and functionality remain equivalent, but the approach to organizing the pre-processor modules differs in style and discoverability, with no clear advantage in correctness, efficiency, or robustness.