A simple Rust application that captures and monitors network packets on a specified network interface, periodically printing and saving packet metrics to a JSON file.
- Captures packets on a specified network interface.
- Counts the total packets and bytes captured.
- Outputs metrics to the console every 5 seconds.
- Saves metrics snapshots to a JSON file (
metrics.json).
- Rust: Ensure that Rust is installed. Install Rust
- pnet crate: This application uses the
pnetcrate for network interface handling and packet processing.
-
Clone the repository:
git clone https://github.com/JeromeWolff/network-monitor.git cd network-monitor -
Build the project:
cargo build --release
Run the application by specifying a network interface to capture packets on. You can find available interfaces using the
ip a command on Linux.
cargo run --release <interface_name>Replace <interface_name> with the name of the network interface to capture packets on.
Contributions are welcome! Please open an issue to discuss what you would like to change.
|
Jerome Wolff |