MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / decode

Method decode

pager_lib/smb/smb_structs.py:519–536  ·  view source on GitHub ↗
(self, message)

Source from the content-addressed store, hash-verified

517 SECURE_PARAMETER_STRUCT_SIZE = struct.calcsize(SECURE_PARAMETER_STRUCT_FORMAT)
518
519 def decode(self, message):
520 assert message.command == SMB_COM_SESSION_SETUP_ANDX
521 if not message.hasExtendedSecurity:
522 if not message.status.hasError:
523 if len(message.parameters_data) < self.NOSECURE_PARAMETER_STRUCT_SIZE:
524 raise ProtocolError('Not enough data to decode SMB_COM_SESSION_SETUP_ANDX (no security extensions) parameters', message.raw_data, message)
525
526 _, _, _, self.action = struct.unpack(self.NOSECURE_PARAMETER_STRUCT_FORMAT, message.parameters_data[:self.NOSECURE_PARAMETER_STRUCT_SIZE])
527 else:
528 if not message.status.hasError or message.status.internal_value == 0xc0000016: # STATUS_MORE_PROCESSING_REQUIRED
529 if len(message.parameters_data) < self.SECURE_PARAMETER_STRUCT_SIZE:
530 raise ProtocolError('Not enough data to decode SMB_COM_SESSION_SETUP_ANDX (with security extensions) parameters', message.raw_data, message)
531
532 _, _, _, self.action, blob_length = struct.unpack(self.SECURE_PARAMETER_STRUCT_FORMAT, message.parameters_data[:self.SECURE_PARAMETER_STRUCT_SIZE])
533 if len(message.data) < blob_length:
534 raise ProtocolError('Not enough data to decode SMB_COM_SESSION_SETUP_ANDX (with security extensions) security blob', message.raw_data, message)
535
536 self.security_blob = message.data[:blob_length]
537
538
539class ComTreeConnectAndxRequest(Payload):

Callers

nothing calls this directly

Calls 1

ProtocolErrorClass · 0.85

Tested by

no test coverage detected