Network Monitoring

Continuously monitor your network for new devices, disconnections, and changes in real-time.

Start Monitoring

netscan -m
[*] Starting network monitor...
[*] Monitoring 192.168.1.0/24
[*] Press Ctrl+C to stop

[14:32:15] New device: 192.168.1.25 (Apple, Inc.) AC:DE:48:XX:XX:XX
[14:35:42] Device offline: 192.168.1.20 (VMware, Inc.)
[14:40:18] New device: 192.168.1.30 (Unknown) 00:00:00:XX:XX:XX

Monitor Options

# Desktop notifications
netscan -m --notify

# Custom scan interval (seconds)
netscan -m --interval 30

# Log to file
netscan -m --log /var/log/netscan.log

# Specific target
netscan -m -t 10.0.0.0/24

# Combine options
netscan -m --notify --interval 60 --log monitor.log

What's Monitored

  • New devices — Alert when unknown MAC appears
  • Offline devices — Notice when devices disconnect
  • IP changes — Track when devices get new IPs
  • Hostname changes — Detect hostname modifications

Scheduled Monitoring

Run periodic scans with cron:

# Edit crontab
crontab -e

# Scan every hour, save results
0 * * * * /usr/local/bin/netscan -s -o ~/scans/hourly_$(date +\%H).json

# Scan every 5 minutes, log new devices
*/5 * * * * /usr/local/bin/netscan -s --json >> ~/scans/continuous.log

Python Monitoring Script

from helpers.scanner import NetworkScanner
import time

scanner = NetworkScanner()
known = set()

while True:
    devices = scanner.quick_scan()
    current = {d['mac'] for d in devices}
    
    new = current - known
    for mac in new:
        dev = next(d for d in devices if d['mac'] == mac)
        print(f"[NEW] {dev['ip']} - {dev['vendor']}")
    
    gone = known - current
    for mac in gone:
        print(f"[OFFLINE] {mac}")
    
    known = current
    time.sleep(60)

Alert Integration

# Slack webhook
netscan -m --webhook https://hooks.slack.com/services/XXX

# Email alerts
netscan -m --email admin@example.com

# Custom script on new device
netscan -m --on-new /path/to/alert.sh