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

Function teredoAddrExtractInfo

scapy/utils6.py:550–563  ·  view source on GitHub ↗

Extract information from a Teredo address. Return value is a 4-tuple made of IPv4 address of Teredo server, flag value (int), mapped address (non obfuscated) and mapped port (non obfuscated). No specific checks are performed on passed address.

(x)

Source from the content-addressed store, hash-verified

548
549
550def teredoAddrExtractInfo(x):
551 # type: (str) -> Tuple[str, int, str, int]
552 """
553 Extract information from a Teredo address. Return value is
554 a 4-tuple made of IPv4 address of Teredo server, flag value (int),
555 mapped address (non obfuscated) and mapped port (non obfuscated).
556 No specific checks are performed on passed address.
557 """
558 addr = inet_pton(socket.AF_INET6, x)
559 server = inet_ntop(socket.AF_INET, addr[4:8])
560 flag = struct.unpack("!H", addr[8:10])[0] # type: int
561 mappedport = struct.unpack("!H", strxor(addr[10:12], b'\xff' * 2))[0]
562 mappedaddr = inet_ntop(socket.AF_INET, strxor(addr[12:16], b'\xff' * 4))
563 return server, flag, mappedaddr, mappedport
564
565
566def in6_iseui64(x):

Callers 2

i2reprMethod · 0.90
_resolve_oneMethod · 0.90

Calls 3

inet_ptonFunction · 0.90
inet_ntopFunction · 0.90
strxorFunction · 0.90

Tested by

no test coverage detected