Skip to content

Instantly share code, notes, and snippets.

@leandroh
Last active December 23, 2015 13:29
Show Gist options
  • Save leandroh/6642050 to your computer and use it in GitHub Desktop.
Save leandroh/6642050 to your computer and use it in GitHub Desktop.
encontrando a raspberry pi em uma rede local
#!/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