Routines for dealing with nmap-style IPv4 address ranges.
The nmap range specification represents between 1 and 4 contiguous IP
address blocks depending on the range specified.
Each octets can be represented with hyphenated range sets according to
the following rules:
* 'x-y' - the hyphenated octet (represents values x
through y)
x must be less than or equal to y
x and y must be values between 0 through 255
Example nmap ranges :
'192.0.2.1' # one IP address
'192.0.2.0-31' # one block with 32 IP addresses.
'192.0.2-3.1-254' # two blocks with 254 IP addresses.
'0-255.0-255.0-255.0-255' # the whole IPv4 address space
The nmap security tool supports a custom type of IPv4 range using
multiple hyphenated octets. This generator provides iterators yielding IP
addresses according to this rule set.
Parameters:
iprange - an nmap-style IP address range.
Returns:
an iterator producing IPAddress objects for each IP in the range.