MCPcopy Index your code
hub / github.com/secdev/scapy / inet_ntop

Function inet_ntop

scapy/pton_ntop.py:133–146  ·  view source on GitHub ↗

Convert an IP address from binary form into text representation.

(af, addr)

Source from the content-addressed store, hash-verified

131
132
133def inet_ntop(af, addr):
134 # type: (socket.AddressFamily, bytes) -> str
135 """Convert an IP address from binary form into text representation."""
136 # Use inet_ntop if available
137 addr = bytes_encode(addr)
138 try:
139 if not socket.has_ipv6:
140 raise AttributeError
141 return socket.inet_ntop(af, addr)
142 except AttributeError:
143 try:
144 return _INET_NTOP[af](addr)
145 except KeyError:
146 raise ValueError("unknown address family %d" % af)

Callers 15

m2iMethod · 0.90
__init__Method · 0.90
in6_getAddrTypeFunction · 0.90
in6_addrtomacFunction · 0.90
in6_get6to4PrefixFunction · 0.90
in6_6to4ExtractAddrFunction · 0.90
in6_getLocalUniquePrefixFunction · 0.90
in6_getRandomizedIfaceIdFunction · 0.90
in6_ctopFunction · 0.90
teredoAddrExtractInfoFunction · 0.90
in6_gethaFunction · 0.90

Calls 1

bytes_encodeFunction · 0.90

Tested by

no test coverage detected