def in6_getifaddr():
"""
Returns a list of 3-tuples of the form (addr, scope, iface) where
'addr' is the address of scope 'scope' associated to the interface
'ifcace'.
This is the list of all addresses of all interfaces available on
the system.
"""
ret = []
interfaces = get_if_list()
for i in interfaces:
addrs = netifaces.ifaddresses(i)
if netifaces.AF_INET6 not in addrs:
continue
for a in addrs[netifaces.AF_INET6]:
addr = a['addr'].split('%')[0]
scope = scapy.utils6.in6_getscope(addr)
ret.append((addr, scope, i))
return ret
评论列表
文章目录