def cidr_to_ipv4(cidr):
    # Takes a CIDR address: 192.168.2.0/24 and returns a list of IP's in it
    ip, network_bits = cidr.split('/', 1)
    host_bits = 32 - int(network_bits)
    # Simplest approach: Turn it into a long, zero out the host bits and then iterate
    long_form = to_long(ip)
    # zero out the host bits
    start = (long_form >> host_bits) << host_bits
    for i in xrange(2**host_bits):
        yield to_dotted_decimal(start | i)
dataset/ETHPy150Open corelan/dnshjmon/dnshjmon.py/cidr_to_ipv4/original