(self, message)
| 921 | PAYLOAD_STRUCT_SIZE = struct.calcsize(PAYLOAD_STRUCT_FORMAT) |
| 922 | |
| 923 | def decode(self, message): |
| 924 | assert message.command == SMB_COM_TRANSACTION2 |
| 925 | |
| 926 | if not message.status.hasError: |
| 927 | if len(message.parameters_data) < self.PAYLOAD_STRUCT_SIZE: |
| 928 | raise ProtocolError('Not enough data to decode SMB_COM_TRANSACTION2 parameters', message.raw_data, message) |
| 929 | |
| 930 | self.total_params_count, self.total_data_count, _, \ |
| 931 | params_bytes_len, params_bytes_offset, params_bytes_displ, \ |
| 932 | data_bytes_len, data_bytes_offset, data_bytes_displ, \ |
| 933 | setup_count, _ = struct.unpack(self.PAYLOAD_STRUCT_FORMAT, message.parameters_data[:self.PAYLOAD_STRUCT_SIZE]) |
| 934 | |
| 935 | if setup_count > 0: |
| 936 | setup_bytes_len = setup_count * 2 |
| 937 | |
| 938 | if len(message.parameters_data) < self.PAYLOAD_STRUCT_SIZE + setup_bytes_len: |
| 939 | raise ProtocolError('Not enough data to decode SMB_COM_TRANSACTION parameters', message.raw_data, message) |
| 940 | |
| 941 | self.setup_bytes = message.parameters_data[self.PAYLOAD_STRUCT_SIZE:self.PAYLOAD_STRUCT_SIZE+setup_bytes_len] |
| 942 | else: |
| 943 | self.setup_bytes = '' |
| 944 | |
| 945 | offset = message.HEADER_STRUCT_SIZE + self.PAYLOAD_STRUCT_SIZE + setup_count * 2 + 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) |
| 946 | |
| 947 | if params_bytes_len > 0: |
| 948 | self.params_bytes = message.data[params_bytes_offset-offset:params_bytes_offset-offset+params_bytes_len] |
| 949 | else: |
| 950 | self.params_bytes = '' |
| 951 | |
| 952 | if data_bytes_len > 0: |
| 953 | self.data_bytes = message.data[data_bytes_offset-offset:data_bytes_offset-offset+data_bytes_len] |
| 954 | else: |
| 955 | self.data_bytes = '' |
| 956 | |
| 957 | |
| 958 | class ComCloseRequest(Payload): |
nothing calls this directly
no test coverage detected