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)
| 548 | |
| 549 | |
| 550 | def 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 | |
| 566 | def in6_iseui64(x): |
no test coverage detected