Ejemplo n.º 1
0
 def getaddr_from_list(self, addr_str, list):
     for name in list:
        if self.str_is_ipv6(list[name][0]):
            # remove trailing zeroes from IPv6 address
            a = pyip6.inet_pton(list[name][0])
            cmp_addr = pyip6.inet_ntop(a)
        else:
            cmp_addr = list[name][0]
        if self.sani(addr_str) == cmp_addr:
             return name
     return None
Ejemplo n.º 2
0
 def getaddr(self, addr):
     if addr is None:
         return None
     if self.str_is_ipv6(addr):
         # remove trailing zeroes from IPv6 address
         a = pyip6.inet_pton(addr)
         addr_str = pyip6.inet_ntop(a)
         if self.str_is_hit(addr):
             return self.getaddr_from_list(addr_str, self.aaaa_hit)
         else:
             return self.getaddr_from_list(addr_str, self.aaaa)
     else:
         return self.getaddr_from_list(addr, self.a)