Skip to content

Instantly share code, notes, and snippets.

@angelbladex
Last active May 5, 2016 14:44
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 angelbladex/c80aaa4fa57226c7e8d7b7f8567413d2 to your computer and use it in GitHub Desktop.
Save angelbladex/c80aaa4fa57226c7e8d7b7f8567413d2 to your computer and use it in GitHub Desktop.
Determinate hosts alive from subnet
#!/bin/bash
subnet="192.168.16.0/24"
#sudo nmap -sP $subnet | grep report | grep -oE "[[:digit:]]{1,3}.[[:digit:]]{1,3}.[[:digit:]]{1,3}.[[:digit:]]{1,3}" | tr '\n' ' '
#sudo nmap -sP $subnet | grep report | grep -oE "[[:digit:]]{1,3}.[[:digit:]]{1,3}.[[:digit:]]{1,3}.[[:digit:]]{1,3}"
sudo nmap -sP $subnet | grep report | grep -oE "([[:digit:]]{1,3}.){3}[[:digit:]]{1,3}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment