Created
December 29, 2011 03:00
-
-
Save cowboy/1531434 to your computer and use it in GitHub Desktop.
I want to know what machines I have on my network. Is there a better (also faster) way than to ping machines 192.168.0.1 - 192.168.0.255?
This file contains hidden or 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/bash | |
| for oct in {1..254}; do | |
| ip="192.168.0.$oct" | |
| echo -en "\033[s$ip" | |
| ping -c 1 -t 1 "$ip" >/dev/null 2>&1 && echo || echo -en "\033[1K\033[u" | |
| done |
Author
Thanks. Since writing this snippet, I did a little research and came up with a shell script wrapper around nmap:
https://github.com/cowboy/dotfiles/blob/master/bin/scan
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can ping the network by using the broadcast address at 192.168.0.255 (assuming your subnet mask is 255.255.255.0) and then running
arp -ato get a list of all devices within it.