(self, message)
| 1338 | message.command = SMB_COM_NT_TRANSACT |
| 1339 | |
| 1340 | def prepare(self, message): |
| 1341 | setup_bytes_len = len(self.setup_bytes) |
| 1342 | params_bytes_len = len(self.params_bytes) |
| 1343 | data_bytes_len = len(self.data_bytes) |
| 1344 | |
| 1345 | padding0 = b'' |
| 1346 | offset = message.HEADER_STRUCT_SIZE + self.PAYLOAD_STRUCT_SIZE + setup_bytes_len + 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) |
| 1347 | if offset % 4 != 0: |
| 1348 | padding0 = b'\0'*(4-offset%4) |
| 1349 | offset += (4-offset%4) |
| 1350 | |
| 1351 | if params_bytes_len > 0: |
| 1352 | params_bytes_offset = offset |
| 1353 | else: |
| 1354 | params_bytes_offset = 0 |
| 1355 | |
| 1356 | offset += params_bytes_len |
| 1357 | padding1 = b'' |
| 1358 | if offset % 4 != 0: |
| 1359 | padding1 = b'\0'*(4-offset%4) |
| 1360 | offset += (4-offset%4) |
| 1361 | |
| 1362 | if data_bytes_len > 0: |
| 1363 | data_bytes_offset = offset |
| 1364 | else: |
| 1365 | data_bytes_offset = 0 |
| 1366 | |
| 1367 | message.parameters_data = \ |
| 1368 | struct.pack(self.PAYLOAD_STRUCT_FORMAT, |
| 1369 | self.max_setup_count, |
| 1370 | 0x00, # Reserved1. Must be 0x00 |
| 1371 | self.total_params_count, |
| 1372 | self.total_data_count, |
| 1373 | self.max_params_count, |
| 1374 | self.max_data_count, |
| 1375 | params_bytes_len, |
| 1376 | params_bytes_offset, |
| 1377 | data_bytes_len, |
| 1378 | data_bytes_offset, |
| 1379 | int(setup_bytes_len / 2), |
| 1380 | self.function) + \ |
| 1381 | self.setup_bytes |
| 1382 | |
| 1383 | message.data = padding0 + self.params_bytes + padding1 + self.data_bytes |
| 1384 | |
| 1385 | |
| 1386 | class ComNTTransactResponse(Payload): |
nothing calls this directly
no outgoing calls
no test coverage detected