Skip to content

hnz1102/watch-ip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Watch-IP

A Rust program that monitors and lists IP addresses received on a specified network interface on Linux.

Features

  • 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

Requirements

Installation

  1. Clone this repository or download the source code
  2. Build the application:
cargo build --release
  1. The executable will be available at target/release/watch-ip

Usage

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

Options

  • -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

Output

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.

Example Output

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

Permissions

This program requires root privileges because packet capturing at the data link layer requires access to raw sockets.

About

Searching IP address in the LAN.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages