MCPcopy Create free account
hub / github.com/secdev/scapy / _strip_padding

Method _strip_padding

scapy/sessions.py:250–260  ·  view source on GitHub ↗

Strip the packet of any padding, and return the padding.

(self, pkt: Packet)

Source from the content-addressed store, hash-verified

248 return src + dst + struct.pack("!HH", pkt.dport, pkt.sport)
249
250 def _strip_padding(self, pkt: Packet) -> Optional[bytes]:
251 """Strip the packet of any padding, and return the padding.
252 """
253 if isinstance(pkt, conf.padding_layer):
254 return cast(bytes, pkt.load)
255 pad = pkt.getlayer(conf.padding_layer)
256 if pad is not None and pad.underlayer is not None:
257 # strip padding
258 del pad.underlayer.payload
259 return cast(bytes, pad.load)
260 return None
261
262 def process(self,
263 pkt: Packet,

Callers 1

processMethod · 0.95

Calls 1

getlayerMethod · 0.45

Tested by

no test coverage detected