What is the most Pythonic way to create a list of IP addresses based on the IPad network netaddr IPRange or netaddr.
If I use them, it includes subnets and broadcast addresses:
hosts = list(IPRange('212.55.64.0','212.55.127.255'))
hosts = IPNetwork('192.168.0.1/24')
So what I need for IPNetwork (192.168.0.0/27) is a list from 192.168.0.1 to 192.168.0.31, but you should not include 192.168.0.0 and 192.168.0.32.
EDIT
Thanks for the info on how to do this using IPy. Does anyone know if this can be done using netaddr?
source
share