Last active
December 23, 2015 13:29
-
-
Save leandroh/6642050 to your computer and use it in GitHub Desktop.
encontrando a raspberry pi em uma rede local
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
#!/usr/bin/env bash | |
ROOT_UID=0 # somente para usuarios com privilegio de root | |
E_NOTROOT=87 # erro de usuario nao root | |
SCRIPT_NAME=$(basename $0) # nome do arquivo | |
if [ "$UID" -ne "$ROOT_UID" ] | |
then | |
echo -e "\e[31m\e[40m[ ✗ ] Você deve executar o script '$SCRIPT_NAME' como root." | |
exit $E_NOTROOT | |
fi | |
encontrar_rpi() { | |
if [ -z "$(dpkg -s arp-scan | grep 'install ok installed')" ] | |
then | |
apt-get install arp-scan | |
fi | |
arp-scan --interface=eth0 --localnet | grep 'b8:27:eb' | |
} | |
encontrar_rpi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment