References: =========== - [MS-CIFS]: 2.2.4.42.2 - [MS-SMB]: 2.2.4.2.2
| 1171 | |
| 1172 | |
| 1173 | class ComReadAndxResponse(Payload): |
| 1174 | """ |
| 1175 | References: |
| 1176 | =========== |
| 1177 | - [MS-CIFS]: 2.2.4.42.2 |
| 1178 | - [MS-SMB]: 2.2.4.2.2 |
| 1179 | """ |
| 1180 | |
| 1181 | PAYLOAD_STRUCT_FORMAT = '<BBHHHHHHHHHHH' |
| 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 | |
| 1199 | class ComDeleteRequest(Payload): |