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

Method decode

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

Source from the content-addressed store, hash-verified

1402 PAYLOAD_STRUCT_SIZE = struct.calcsize(PAYLOAD_STRUCT_FORMAT)
1403
1404 def decode(self, message):
1405 assert message.command == SMB_COM_NT_TRANSACT
1406
1407 if not message.status.hasError:
1408 _, self.total_params_count, self.total_data_count, \
1409 params_count, params_offset, params_displ, \
1410 data_count, data_offset, data_displ, setup_count = struct.unpack(self.PAYLOAD_STRUCT_FORMAT,
1411 message.parameters_data[:self.PAYLOAD_STRUCT_SIZE])
1412
1413 self.setup_bytes = message.parameters_data[self.PAYLOAD_STRUCT_SIZE:self.PAYLOAD_STRUCT_SIZE+setup_count*2]
1414
1415 if params_count > 0:
1416 params_offset -= message.HEADER_STRUCT_SIZE + self.PAYLOAD_STRUCT_SIZE + setup_count*2 + 2
1417 self.params_bytes = message.data[params_offset:params_offset+params_count]
1418 else:
1419 self.params_bytes = b''
1420
1421 if data_count > 0:
1422 data_offset -= message.HEADER_STRUCT_SIZE + self.PAYLOAD_STRUCT_SIZE + setup_count*2 + 2
1423 self.data_bytes = message.data[data_offset:data_offset+data_count]
1424 else:
1425 self.data_bytes = b''

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected