コード例 #1
0
    def expand_netmask(self, netmask):
        """Expand netmask based on the terms in the database.
           Doesn't bother using the database for tiny networks"""
        network = IPy.IP(netmask)
        if network.len() < 32:
            return [serialize_ip(str(ip)) for ip in network]
        ips = self.ips_from_network(network)

        if network.prefixlen() % 8 !=0:
            ips = [ip for ip in ips if IPy.IP(deserialize_ip(ip)) in network]
        return ips
コード例 #2
0
    def expand_netmask(self, netmask):
        """Expand netmask based on the terms in the database.
           Doesn't bother using the database for tiny networks"""
        network = IPy.IP(netmask)
        if network.len() < 32:
            return [serialize_ip(str(ip)) for ip in network]
        ips = self.ips_from_network(network)

        if network.prefixlen() % 8 != 0:
            ips = [ip for ip in ips if IPy.IP(deserialize_ip(ip)) in network]
        return ips
コード例 #3
0
ファイル: test_util.py プロジェクト: zwjwhxz/netflow-indexer
def serde_case(ip):
    other = deserialize_ip(serialize_ip(ip))
    eq_(ip, other)
コード例 #4
0
def serde_case(ip):
    other = deserialize_ip(serialize_ip(ip))
    eq_(ip, other)