Add pve2/root/utilities/pingsweep.sh

This commit is contained in:
2025-03-27 11:51:47 -07:00
parent 6230d7b587
commit 7b3ae9139c

View File

@@ -0,0 +1,10 @@
#!/bin/bash
# Scan the local network (192.168.1.0/24) for active hosts using ICMP ping,
# displaying only hosts that respond with their IP address and response time.
for ip in $(seq 1 254); do
ping -c 1 -W 1 192.168.1.$ip | grep "64 bytes" | sed -E "s/^.*from (.*): icmp_seq=1 ttl=.* time=(.*) ms/192.168.1.$(printf '%3d' $ip) \2 ms/" &
done | sort -t. -k1,1n -k2,2n -k3,3n -k4,4n
wait