daily pastebin goal
7%
SHARE
TWEET

Untitled

a guest Apr 16th, 2018 44 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash -x
  2.  
  3. set -e
  4. set -u
  5. set -o pipefail
  6.  
  7. if [[ "${EUID}" -ne '0' ]]; then
  8.     echo "this script requires to run as root"
  9.     exit 1
  10. fi
  11.  
  12. subnet="$(ip -o -f inet addr show | awk '/scope global/ {print $4}')"
  13. found_ip="$(nmap -sP "${subnet}" | awk '/^Nmap/{ip=$NF}/B8:27:EB/{print ip}' | sed 's/[()]//g')"
  14.  
  15. [[ '' == "${found_ip}" ]] && (echo 'not found'; exit 1)
RAW Paste Data
Top