Last active
June 27, 2024 14:00
-
-
Save niun/7c1a1da47d0f433e2ad5 to your computer and use it in GitHub Desktop.
Find Raspberry Pi in network (looking for MAC address vendor prefix of Raspberry Pi Foundation using nmap, awk for ipv4 / ping6, ip, grep for ipv6 neighbour discovery)
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
sudo nmap -sP 192.168.0.0/24 | awk '/^Nmap/{ip=$NF}/B8:27:EB/{print ip}' |
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
IFACE=eth0 | |
# trigger IPv6 neighbour discovery with link-local scope multicast: | |
ping6 -c2 -I $IFACE ff02::1 > /dev/null | |
# print the results, filtered by MAC address vendor prefix of Raspberry Pi Foundation: | |
ip -6 neigh | grep b8:27:eb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks. It was very useful. I've done some small changes to recursively search until the user breaks the loop: