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

Method decode

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

Source from the content-addressed store, hash-verified

1182 PAYLOAD_STRUCT_SIZE = struct.calcsize(PAYLOAD_STRUCT_FORMAT)
1183
1184 def decode(self, message):
1185 assert message.command == SMB_COM_READ_ANDX
1186
1187 if not message.status.hasError:
1188 if len(message.parameters_data) < self.PAYLOAD_STRUCT_SIZE:
1189 raise ProtocolError('Not enough data to decode SMB_COM_READ_ANDX parameters', message.raw_data, message)
1190
1191 _, _, _, _, _, _, self.data_length, data_offset, _, _, _, _, _ = struct.unpack(self.PAYLOAD_STRUCT_FORMAT,
1192 message.parameters_data[:self.PAYLOAD_STRUCT_SIZE])
1193
1194 offset = data_offset - message.HEADER_STRUCT_SIZE - self.PAYLOAD_STRUCT_SIZE - 2 # constant 2 is for the ByteCount field in the SMB header (i.e. field which indicates number of data bytes after the SMB parameters)
1195 self.data = message.data[offset:offset+self.data_length]
1196 assert len(self.data) == self.data_length
1197
1198
1199class ComDeleteRequest(Payload):

Callers

nothing calls this directly

Calls 1

ProtocolErrorClass · 0.85

Tested by

no test coverage detected