A Rust program that monitors and lists IP addresses received on a specified network interface on Linux.
- Real-time monitoring of incoming IP addresses
- Reverse DNS lookup to display hostnames for IP addresses
- Displays source IP addresses with timing information
- Tracks packet counts per IP address
- Supports both IPv4 and IPv6 addresses
- Color-coded output for better readability
- Configurable update interval
- Rust and Cargo (installation: https://www.rust-lang.org/tools/install)
- Linux operating system
- Root privileges (required to capture network packets)
- Clone this repository or download the source code
- Build the application:
cargo build --release
- The executable will be available at
target/release/watch-ip
Run the program with sudo privileges and specify the network interface to monitor:
sudo ./target/release/watch-ip --interface <INTERFACE_NAME>
For example:
sudo ./target/release/watch-ip --interface eth0
-i, --interface <INTERFACE>: Network interface name to monitor (required)-t, --interval <SECONDS>: Update interval in seconds (default: 5)-h, --help: Display help information-V, --version: Display version information
The program displays a table with the following columns:
- IP Address: The source IP address detected on the network
- Hostname: The hostname resolved through reverse DNS lookup (displays the IP address if lookup fails)
- First Seen: Time since the IP was first detected (in seconds)
- Last Seen: Time since the IP was last detected (in seconds)
- Packets: Number of packets received from this IP
The display is automatically sorted by packet count (highest to lowest) and updates at the specified interval. The table format accommodates both IPv4 and IPv6 addresses. Press Ctrl+C to exit the program.
IP Address List - 2023-04-22 15:30:45
------------------------------------------------------------------------------------------------------------------------
IP Address Hostname First Seen (s) Last Seen (s) Packets
------------------------------------------------------------------------------------------------------------------------
192.168.1.1 router.home 30 s ago 2 s ago 211
8.8.8.8 dns.google 45 s ago 5 s ago 42
fe80::1234:5678:abcd:ef01 fe80::1234:5678:abcd:ef01 20 s ago 10 s ago 15
------------------------------------------------------------------------------------------------------------------------
Total unique IPs: 3
This program requires root privileges because packet capturing at the data link layer requires access to raw sockets.