Created
August 15, 2021 09:49
-
-
Save vitali2y/89ed97ee3f5f5fbfb411bb6b6b09bee9 to your computer and use it in GitHub Desktop.
To scan IPs in your local network
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# set -x # uncomment for debugging | |
pingone(){ | |
if ping -w 2 -q -c 1 192.168.1."$1" > /dev/null | |
then | |
printf "IP %s is up\n" 192.168.1."$1" | |
fi | |
} | |
NUM=1 | |
while [ $NUM -lt 255 ]; do | |
pingone "$NUM" & | |
NUM=$(expr "$NUM" + 1) | |
done | |
wait | |
# ✗ ./ping_script.sh | |
# IP 192.168.1.1 is up | |
# IP 192.168.1.152 is up | |
# IP 192.168.1.117 is up | |
# ✗ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Rust lib to ping network host by IP