Created
December 30, 2012 19:28
-
-
Save treyhunner/4414570 to your computer and use it in GitHub Desktop.
Script for finding Raspberry Pi computers on the network. The scripts searches for MAC addresses starting with `b8:27:eb:` (the Ethernet port on the Pi) and `80:1f:02` (Edimax wifi USB dongle).
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 which nmap > /dev/null ; then | |
echo "Running nmap as root\n" | |
IP_RANGE=$(ip addr | grep "inet " | awk '{ print $2}' | grep -v 127.0.0) | |
sudo nmap -sP $IP_RANGE | grep -B2 -i 'b8:27:eb\|80:1f:02' | |
else | |
if which arp-scan > /dev/null ; then | |
echo "Running arp-scan as root\n" | |
sudo arp-scan --interface=eth0 --localnet | grep 'b8:27:eb\|80:1f:02' | |
else | |
echo "Error: Must instal nmap or arp-scan." 1>&2 | |
echo "To install nmap on Ubuntu:" 1>&2 | |
echo " sudo apt-get install nmap" 1>&2 | |
exit 1 | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment