Skip to content

Instantly share code, notes, and snippets.

@frafra
Last active May 28, 2021 23:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frafra/c367f18b87b940307350cebc8d43bea7 to your computer and use it in GitHub Desktop.
Save frafra/c367f18b87b940307350cebc8d43bea7 to your computer and use it in GitHub Desktop.
Scan local network and show hostname, IP, MAC address, brand
#!/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