Skip to content

Instantly share code, notes, and snippets.

@phmullins
Last active September 1, 2016 23:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phmullins/114fb9fb632b00c8790f5100a4b738c6 to your computer and use it in GitHub Desktop.
Save phmullins/114fb9fb632b00c8790f5100a4b738c6 to your computer and use it in GitHub Desktop.
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