Created
February 15, 2016 06:29
-
-
Save jsidhu/a102bf49d256b43d73b4 to your computer and use it in GitHub Desktop.
NMAP: find free ips
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
nmap -v -sn -n 192.168.1.0/24 -oG - | awk '/Status: Down/{print $2}' | |
When you use the -v option, Nmap will print the addresses it finds as "down" in addition to the ones that are "up". | |
Instead of -sP, I've substituted the newer spelling -sn, which still accomplishes the same scan, but means "skip the port scan" instead of the misleading "Ping scan" (since the host discovery phase does not necessarily mean an ICMP Echo scan or Ping). | |
The -n option skips reverse DNS lookups, which buys you a bit of time, since you aren't interested in names but just IP addresses. | |
The -oG option tells Nmap to output grepable format, which is easier for awk to process. The argument "-" tells it to send this output to stdout. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment