I\'m trying to create script that I can input a set of prefixes, which will then list all IP addresses within the prefixes (including network/host/broadcast).
An ex
nmap
is useful, but an overkill.
You can use prips instead. Saves you the hassle of grepping out the extra output from nmap
and using awk
.
Calling prips 192.168.0.0/23
will print what you need.
I use the following to skip the network address and broadcast: prips "$subnet" | sed -e '1d; $d'
Prips also has other useful options, e.g. being able to sample every n-th IP.
It's available via apt
,brew
,rpm
and as tar.gz
.