Commit Graph

181 Commits

Author SHA1 Message Date
Marco Cadetg
810b865841 fix(linux): resolve eBPF thread names to main process names
Use periodic procfs PID cache to resolve thread names (e.g. 'Socket Thread')
to main process names (e.g. 'firefox'). Falls back to eBPF name for
short-lived processes that have already exited.
2025-12-07 11:09:29 +01:00
Marco Cadetg
5a059a3a12 feat: add Landlock sandbox and capability dropping for Linux (#86)
* feat: add Landlock sandbox and capability dropping for Linux

- Restrict filesystem access to /proc only after initialization
- Block TCP bind/connect on kernel 6.4+ (network sandbox)
- Drop CAP_NET_RAW after pcap handle opened
- Add --no-sandbox and --sandbox-strict CLI options
- Show privilege info on non-Linux platforms in UI
- Add SECURITY.md documentation

* fix: remove unused set_sandbox_info and hide Landlock line on non-Linux

* fix: gate SandboxInfo to Linux only to fix clippy warnings

* fix: add is_admin() function for Windows builds

The Windows build was failing because ui.rs called crate::is_admin()
but the function didn't exist. Added the implementation using Windows
Security API to check if the process has elevated privileges.

Also added Win32_Security feature to windows crate dependencies.

* fix: add is_admin() to main.rs for Windows binary crate

The previous fix added is_admin() to lib.rs but ui.rs is compiled
as part of the binary crate (main.rs), not the library crate.
Added the function to main.rs so crate::is_admin() resolves correctly.
2025-12-06 17:50:21 +01:00
Marco Cadetg
dd0b7e0923 fix: make RateTracker tests deterministic with injectable timestamps (#85) 2025-12-06 15:36:05 +01:00
Marco Cadetg
5c8ca435b3 refactor: simplify QUIC DPI and reorganize platform code (#84)
* refactor: simplify QUIC DPI and unify SNI extraction helpers

* refactor: reorganize platform code and improve code structure
2025-12-06 13:31:17 +01:00
Marco Cadetg
3a8e8614bc feat: reorganize platform code into per-platform directories (#81)
* feat: reorganize platform code into per-platform directories

- Move platform files into linux/, macos/, windows/, freebsd/ subdirectories
- Unify create_process_lookup() API with _use_pktap parameter across all platforms
- Update build.rs paths for eBPF program location
- Reduce cfg attributes in main mod.rs from ~42 to 8

* fix: widen tolerance for test_sliding_window_no_skip_first_sample

Increase acceptable range from 9000-11000 to 5000-15000 to account
for timing variability on macOS ARM CI runners.

* docs: update Linux build dependencies and remove EBPF_BUILD.md

- Add missing build-essential, pkg-config, zlib1g-dev to documentation
- Update rust.yml CI with complete dependencies
- Remove EBPF_BUILD.md (info already in INSTALL.md)
- Update references in README.md and ARCHITECTURE.md
2025-11-30 18:08:11 +01:00
Marco Cadetg
6e1426170b Feature/interface stats (#79)
* feat: adding interface stats

* macOS specific improvements

* fix windows interface stats
2025-11-22 17:34:53 +01:00
Marco Cadetg
dda39e5cdf feat: add TCP network analytics with retransmission detection (#72)
Adds real-time TCP connection quality monitoring:
- Retransmission detection via sequence number analysis
- Out-of-order packet tracking
- Fast retransmit detection (RFC 2581)
- Per-connection and aggregate statistics
- Network Stats panel in UI
- Platform-independent implementation using pcap data

Statistics show both active (current connections) and total
(cumulative) counts. Individual connection details display
per-connection metrics for troubleshooting network issues.
2025-11-14 12:38:38 +01:00
Marco Cadetg
85b2662c85 feat: add freebsd (#71)
* feat: add freebsd
2025-11-02 19:47:26 +01:00
Marco Cadetg
03cc04624f chore: cleanup dead code 2025-10-31 14:31:07 +01:00
Marco Cadetg
a46617b83a Release v0.15.0
- Ubuntu PPA packaging support
- Bandwidth sorting by combined up+down total
- Removed CAP_NET_ADMIN requirement (read-only capture)
- Improved bandwidth rate tracking accuracy
- Updated dependencies: clap, clap_mangen, clap_complete, dns-lookup, windows, zip, libc
2025-10-25 21:35:00 +02:00
Marco Cadetg
a0e1e6d080 feat: sort bandwidth by combined up+down total (#64)
Changed bandwidth sorting to use the sum of upload and download speeds
instead of separate sorting for each direction. This provides a simpler
way to identify connections with the highest total bandwidth usage.

- Replace BandwidthDown/BandwidthUp with single BandwidthTotal enum
- Update sort logic to calculate combined rates
- Simplify UI to show "Down/Up ↓/↑" indicator
- Update documentation and tests
2025-10-25 20:58:20 +02:00
Marco Cadetg
fe7f694a4b fix: improve bandwidth rate tracking accuracy and stability (#63)
- Change sliding window from 5s to 10s for stable measurements
- Increase max_samples from 100 to 20,000 to preserve full time window
- Fix minimum time span threshold from 100ms to 1s for stability
- Remove skip(1) bug that excluded first sample from calculations
- Remove artificial decay logic causing rate drops during transfers
- Add idle connection detection for proper zero-rate display
- Update tests for 1s minimum requirement and add edge case coverage
2025-10-25 18:27:37 +02:00
Marco Cadetg
4ae965a8a4 feat: remove CAP_NET_ADMIN and CAP_SYS_ADMIN, use read-only packet capture (#59)
Remove CAP_NET_ADMIN requirement and eliminate need for CAP_SYS_ADMIN on
modern kernels by using non-promiscuous mode for packet capture. This
significantly reduces security surface by following principle of least privilege.
2025-10-19 17:03:58 +02:00
Marco Cadetg
0fa0a61ab7 feat: add JSON logging for SIEM integration (#9) (#44)
Add --json-log flag to output connection events as JSON lines.
Logs new_connection and connection_closed events with IPs, ports,
protocol, DPI info, and traffic statistics for SIEM tools.
2025-10-12 09:11:08 +02:00
Marco Cadetg
529cab9d12 fix: eliminate excessive procfs scanning causing high CPU usage (#45)
The procfs-based process lookup was triggering a full scan on every cache
miss instead of relying on periodic refresh. This caused 50+ full procfs
scans per enrichment cycle when multiple connections lacked process info.

Changed get_process_for_connection() to do simple cache lookups only.
Periodic refresh (every 5s) is already handled by the enrichment thread.

Also added PROFILING.md with flamegraph profiling guide.
2025-10-11 16:40:47 +02:00
Marco Cadetg
0d55a86605 Add TUN/TAP interface support (#43)
* feat: add TUN/TAP interface support

Add comprehensive support for TUN/TAP virtual network interfaces by
refactoring link layer parsing into modular components.

New modules:
- link_layer: Modular packet parsing (ethernet, raw_ip, linux_sll, tun_tap)
- protocol: Dedicated TCP/UDP/ICMP parsers

Changes:
- Remove TUN/TAP interface exclusions in capture.rs
- Add TUN/TAP detection and parsing support
- macOS PKTAP support with conditional compilation

Platform compatibility:
- Linux: Full TUN/TAP support
- macOS: TUN (utun*) and TAP support
- Windows: No breaking changes

Fixes #39
2025-10-11 14:10:50 +02:00
Marco Cadetg
0d02b99b79 Bundle vmlinux.h files to eliminate network dependency during builds (#41)
* feat: bundle vmlinux.h files to eliminate network dependency during builds

- Add bundled vmlinux.h for x86, aarch64, and arm (~3MB total)
- Remove network download code from build.rs
- Remove ureq dependency and transitive deps
- Update Dockerfile to copy bundled headers
- Remove obsolete vmlinux_min.h
- Update documentation to reflect bundled approach

Fixes #38
2025-10-09 12:07:40 +02:00
Marco Cadetg
6a8e738a63 feat: implement Windows process identification via IP Helper API (#37)
- Add Windows process lookup using GetExtendedTcpTable/GetExtendedUdpTable
- Resolve process names via OpenProcess and QueryFullProcessImageNameW
- Support TCP/UDP IPv4 and IPv6 connections
- Implement time-based caching with 2-second TTL
- Fix port byte order conversion from network to host order
- Migrate from winapi to windows crate (v0.59)
- Add debug logging for process lookup operations
- Update documentation in ROADMAP.md and README.md

Closes #36
2025-10-04 16:32:08 +02:00
Marco Cadetg
80b5b0c2c1 feat: privilege detection (#31)
* feat: detect insufficient privileges before network interface access

- Add privilege detection module for Linux, macOS, and Windows
- Check privileges before TUI initialization for visible errors
- Provide platform-specific instructions (sudo, setcap, Docker flags)
- Detect container environments and provide Docker-specific guidance
2025-10-04 15:33:42 +02:00
Marco Cadetg
c832718833 fix: use actual packet length from IP headers instead of captured length (#35)
Fixes #34 - Extract actual packet size from IP header Total Length field
instead of using captured buffer length (limited by snaplen). This fixes
severe undercounting for large packets (NFS, jumbo frames).
2025-10-03 21:20:52 +02:00
Marco Cadetg
9481cef4fd Fix windows double key issue (#27)
* fix: windows double key event
2025-10-01 20:28:39 +02:00
Marco Cadetg
9ac3714ca4 fix: windows msi missing VC++ dist (#26)
- Add startup check that detects missing Npcap/WinPcap DLLs
- Display helpful error message with installation instructions
- Update README with note about runtime dependency checking
- Add winapi dependency for Windows DLL detection
2025-10-01 20:17:37 +02:00
Marco Cadetg
34fcec5273 feat: vim style g and shift G jump beginning / end 2025-10-01 18:25:23 +02:00
Marco Cadetg
e2bba4c854 fix: any interface on linux and add --show-localhost (#25) 2025-10-01 18:10:24 +02:00
Marco Cadetg
1cd719ab3b fix: allow any interface on linux (#24) 2025-10-01 17:41:38 +02:00
Marco Cadetg
ebdbff6b7c feat: improve connection navigation and cleanup indication (#23) 2025-10-01 17:08:28 +02:00
Marco Cadetg
aac52a79d4 feat: adding sort (#22) 2025-10-01 10:53:56 +02:00
Marco Cadetg
5c656130e0 feat: add port option with using p (#21) 2025-10-01 07:36:30 +02:00
Marco Cadetg
42db7f5614 fix: release workflow (#17)
* Remove musl targets to simplify Linux builds and fix cross-compilation issues
* Enable eBPF by default on Linux via linux-default feature for better packet capture
* Add macOS code signing and notarization support with graceful fallback for unsigned builds
* Fix Windows MSI packaging with improved WiX configuration and Npcap library linking
* Auto-extract changelog content from CHANGELOG.md into GitHub release notes
* Fix ARM cross-compilation (aarch64, armv7) with proper library paths and eBPF support
* Add comprehensive installation documentation for DMG, MSI, DEB, and RPM packages
* Allow re-running releases with --clobber flag for artifact uploads
2025-09-30 09:39:26 +02:00
Marco Cadetg
eca0e6000d feat: add cross-platform packaging and release automation
- Add GitHub Actions workflow for automated releases
- Create .deb, .rpm, AppImage, .dmg, and .msi packages
- Generate shell completions and manpages in build.rs
- Add platform-specific icons from rustnet3.svg
- Include eBPF dependencies for Linux packages
- Support Windows 32-bit and 64-bit builds
- Extract shared CLI module to prevent duplication
2025-09-29 11:56:55 +02:00
Marco Cadetg
799d66cf86 feat: Add experimental eBPF support for enhanced socket tracking (#11)
* feat: Add experimental eBPF support for enhanced socket tracking

- Implement eBPF-based socket tracker for Linux with CO-RE support
- Add minimal vmlinux header (5.5KB) instead of full 3.4MB file
- Create graceful fallback mechanism to procfs when eBPF unavailable
- Add comprehensive eBPF build documentation
- Integrate libbpf-rs for eBPF program loading and management
- Support both IPv4 and IPv6 socket tracking
- Add capability checking for required permissions

The eBPF feature is optional and disabled by default. When enabled,
it provides faster and more accurate process-to-socket mapping on
Linux systems with appropriate permissions.
2025-09-18 11:46:03 +02:00
Marco Cadetg
3d4b1a8121 feat: successfully tested on windows 2025-09-12 17:57:49 +02:00
Marco Cadetg
459504ebb6 feat: ssh dpi 2025-09-11 12:32:53 +02:00
Marco Cadetg
b4beaf01ef fix: handle SecureCRT backspace issue 2025-09-11 08:56:29 +02:00
Marco Cadetg
8982d24abd implement option to filter for state 2025-09-10 11:35:34 +02:00
Marco Cadetg
3329eed6c5 cargo fmt 2025-09-09 15:45:14 +02:00
Marco Cadetg
445f70f1e8 option to filter connections 2025-09-09 15:35:16 +02:00
Marco Cadetg
4b97828a3f improve traffic monitoring 2025-08-29 10:44:33 +02:00
Marco Cadetg
a51acfbe28 improve linux build warnings 2025-08-29 10:03:24 +02:00
Marco Cadetg
374079ef71 fix: update the rustnet versin based on Cargo.toml version 2025-08-28 15:53:50 +02:00
Marco Cadetg
6b24e86675 fix: get rid of warnings and fix all clippy issues 2025-08-28 15:28:58 +02:00
Marco Cadetg
427d738426 improve connection state tracking 2025-08-28 14:28:10 +02:00
Marco Cadetg
d7059741e2 fix: bandwidth counters and update of information 2025-08-28 13:32:44 +02:00
Marco Cadetg
791027a6af adding human readable cipher suite names 2025-08-28 10:24:37 +02:00
Marco Cadetg
f183417216 use pktab on mac to retrieve process information 2025-08-27 17:43:54 +02:00
Marco Cadetg
6abf95e53e update logging to be optional and by default not enabled 2025-08-27 09:12:58 +02:00
Marco Cadetg
7b2c2d4783 try to improve quic dissector 2025-08-07 13:53:44 +02:00
Marco Cadetg
2b5daa95ac improve quic dissector 2025-08-06 18:28:45 +02:00
Marco Cadetg
52e13ee3b5 improve TLS parsing 2025-08-06 11:28:38 +02:00
Marco Cadetg
86831ba405 improve quic dpi 2025-08-06 08:23:20 +02:00