MCPcopy Create free account
hub / github.com/SecurityInnovation/PGPy / Packet

Class Packet

pgpy/packet/types.py:143–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141
142
143class Packet(Dispatchable):
144 __typeid__ = -1
145 __headercls__ = Header
146
147 def __init__(self, _=None):
148 super(Packet, self).__init__()
149 self.header = self.__headercls__()
150 if isinstance(self.__typeid__, int):
151 self.header.tag = self.__typeid__
152
153 @abc.abstractmethod
154 def __bytearray__(self):
155 return self.header.__bytearray__()
156
157 def __len__(self):
158 return len(self.header) + self.header.length
159
160 def __repr__(self):
161 return "<{cls:s} [tag {tag:02d}] at 0x{id:x}>".format(cls=self.__class__.__name__, tag=self.header.tag, id=id(self))
162
163 def update_hlen(self):
164 self.header.length = len(self.__bytearray__()) - len(self.header)
165
166 @abc.abstractmethod
167 def parse(self, packet):
168 if self.header.tag == 0:
169 self.header.parse(packet)
170
171
172class VersionedPacket(Packet):

Callers 11

test_loadMethod · 0.90
fuzz_pktMethod · 0.90
test_add_markerMethod · 0.90
parseMethod · 0.85
parseMethod · 0.85
_getpktMethod · 0.85
parseMethod · 0.85

Calls

no outgoing calls

Tested by 6

test_loadMethod · 0.72
fuzz_pktMethod · 0.72
test_add_markerMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…