Skip to content

Instantly share code, notes, and snippets.

@phmullins
Last active Sep 1, 2016
Embed
What would you like to do?
Discover hosts on a network
#!/bin/bash
# This bash script will output the IP addresses of all the live hosts on a network. Note: Hosts that filter ICMP
# are not included in this list.
#
# Usage: ./mapnet IP_RANGE Example: ./mapnet 192.168.1.1/24
clear
if [ -z "$1" ]; then
exit "Input IP range to scan. Example: 192.168.1.0/24"
fi
nmap $1 -n -sP | grep report | awk '{print $5}'
echo "Mapnet return code: $?"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment