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

Method __init__

scapy/layers/ntlm.py:253–284  ·  view source on GitHub ↗
(
        self,
        _pkt=b"",  # type: Union[bytes, bytearray]
        post_transform=None,  # type: Any
        _internal=0,  # type: int
        _underlayer=None,  # type: Optional[Packet]
        _parent=None,  # type: Optional[Packet]
        **fields,  # type: Any
    )

Source from the content-addressed store, hash-verified

251 _NTLM_PAYLOAD_FIELD_NAME = "Payload"
252
253 def __init__(
254 self,
255 _pkt=b"", # type: Union[bytes, bytearray]
256 post_transform=None, # type: Any
257 _internal=0, # type: int
258 _underlayer=None, # type: Optional[Packet]
259 _parent=None, # type: Optional[Packet]
260 **fields, # type: Any
261 ):
262 # pop unknown fields. We can't process them until the packet is initialized
263 unknown = {
264 k: fields.pop(k)
265 for k in list(fields)
266 if not any(k == f.name for f in self.fields_desc)
267 }
268 super(_NTLMPayloadPacket, self).__init__(
269 _pkt=_pkt,
270 post_transform=post_transform,
271 _internal=_internal,
272 _underlayer=_underlayer,
273 _parent=_parent,
274 **fields,
275 )
276 # check unknown fields for implicit ones
277 local_fields = next(
278 [y.name for y in x.fields]
279 for x in self.fields_desc
280 if x.name == self._NTLM_PAYLOAD_FIELD_NAME
281 )
282 implicit_fields = {k: v for k, v in unknown.items() if k in local_fields}
283 for k, value in implicit_fields.items():
284 self.setfieldval(k, value)
285
286 def getfieldval(self, attr):
287 # Ease compatibility with _NTLMPayloadField

Callers

nothing calls this directly

Calls 4

setfieldvalMethod · 0.95
popMethod · 0.80
itemsMethod · 0.80
__init__Method · 0.45

Tested by

no test coverage detected