Last active
May 28, 2021 23:05
-
-
Save frafra/c367f18b87b940307350cebc8d43bea7 to your computer and use it in GitHub Desktop.
Scan local network and show hostname, IP, MAC address, brand
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 | |
if (( $# != 1 )); then | |
>&2 echo "Usage: $0 NETWORK_INTERFACE" | |
exit 1 | |
fi | |
sudo arp-scan -gx --localnet -I $1 | | |
awk '{ | |
l="" | |
"avahi-resolve -a " $1 " 2>/dev/null" | getline l | |
split(l, a, " ") | |
a[1]=="Failed" ? hn="" : hn=a[2] | |
print hn "\t" $0 | |
}' | column -ts $'\t' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment