Created
August 29, 2016 00:19
-
-
Save branning/7cc05201a33aceb2c590816ead6f0322 to your computer and use it in GitHub Desktop.
Find live hosts on local network with nmap
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/bash | |
# | |
# Find live hosts on local network with nmap | |
quiet() { $@ >/dev/null 2>&1; } | |
error() { echo 2>&1 "$@"; } | |
if ! quiet command -v nmap | |
then | |
error "You must install nmap." | |
case $OSTYPE in | |
darwin*) error 'Maybe try `brew install nmap`';; | |
linux*) error 'Maybe try `apt-get install nmap`';; | |
esac | |
fi | |
base_ip=${1-192.168.2.1} | |
nmap -sP ${base_ip}/24 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment