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

Class TrailerBytes

scapy/fields.py:690–708  ·  view source on GitHub ↗

Reverses slice operations to take from the back of the packet, not the front

Source from the content-addressed store, hash-verified

688
689
690class TrailerBytes(bytes):
691 """
692 Reverses slice operations to take from the back of the packet,
693 not the front
694 """
695
696 def __getitem__(self, item): # type: ignore
697 # type: (Union[int, slice]) -> Union[int, bytes]
698 if isinstance(item, int):
699 if item < 0:
700 item = 1 + item
701 else:
702 item = len(self) - 1 - item
703 elif isinstance(item, slice):
704 start, stop, step = item.start, item.stop, item.step
705 new_start = -stop if stop else None
706 new_stop = -start if start else None
707 item = slice(new_start, new_stop, step)
708 return super(self.__class__, self).__getitem__(item)
709
710
711class TrailerField(_FieldContainer):

Callers 1

getfieldMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…