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

Method i2repr

scapy/fields.py:982–996  ·  view source on GitHub ↗
(self, pkt, x)

Source from the content-addressed store, hash-verified

980 return self.h2i(pkt, x)
981
982 def i2repr(self, pkt, x):
983 # type: (Optional[Packet], Optional[Union[str, Net6]]) -> str
984 if x is None:
985 return self.i2h(pkt, x)
986 elif not isinstance(x, Net6) and not isinstance(x, list):
987 if in6_isaddrTeredo(x): # print Teredo info
988 server, _, maddr, mport = teredoAddrExtractInfo(x)
989 return "%s [Teredo srv: %s cli: %s:%s]" % (self.i2h(pkt, x), server, maddr, mport) # noqa: E501
990 elif in6_isaddr6to4(x): # print encapsulated address
991 vaddr = in6_6to4ExtractAddr(x)
992 return "%s [6to4 GW: %s]" % (self.i2h(pkt, x), vaddr)
993 elif isinstance(x, _ScopedIP) and x.scope:
994 return repr(x)
995 r = self.i2h(pkt, x) # No specific information to return
996 return r if isinstance(r, str) else repr(r)
997
998 def randval(self):
999 # type: () -> RandIP6

Callers

nothing calls this directly

Calls 5

i2hMethod · 0.95
in6_isaddrTeredoFunction · 0.90
teredoAddrExtractInfoFunction · 0.90
in6_isaddr6to4Function · 0.90
in6_6to4ExtractAddrFunction · 0.90

Tested by

no test coverage detected