References: =========== - [MS-SMB2]: 2.2.31
| 552 | |
| 553 | |
| 554 | class SMB2IoctlRequest(Structure): |
| 555 | """ |
| 556 | References: |
| 557 | =========== |
| 558 | - [MS-SMB2]: 2.2.31 |
| 559 | """ |
| 560 | |
| 561 | STRUCTURE_FORMAT = "<HHI16sIIIIIIII" |
| 562 | STRUCTURE_SIZE = struct.calcsize(STRUCTURE_FORMAT) |
| 563 | |
| 564 | def __init__(self, fid, ctlcode, flags, in_data, max_out_size = 65536): |
| 565 | self.ctlcode = ctlcode |
| 566 | self.fid = fid |
| 567 | self.flags = flags |
| 568 | self.in_data = in_data |
| 569 | self.max_out_size = max_out_size |
| 570 | |
| 571 | def initMessage(self, message): |
| 572 | Structure.initMessage(self, message) |
| 573 | message.command = SMB2_COM_IOCTL |
| 574 | |
| 575 | def prepare(self, message): |
| 576 | message.data = struct.pack(self.STRUCTURE_FORMAT, |
| 577 | 57, # Structure size. Must be 57 as mandated by [MS-SMB2] 2.2.31 |
| 578 | 0, # Reserved |
| 579 | self.ctlcode, # CtlCode |
| 580 | self.fid, |
| 581 | SMB2Message.HEADER_SIZE + self.STRUCTURE_SIZE, # InputOffset |
| 582 | len(self.in_data), # InputCount |
| 583 | 0, # MaxInputResponse |
| 584 | 0, # OutputOffset |
| 585 | 0, # OutputCount |
| 586 | self.max_out_size, # MaxOutputResponse |
| 587 | self.flags, # Flags |
| 588 | 0 # Reserved |
| 589 | ) + self.in_data |
| 590 | |
| 591 | |
| 592 | class SMB2IoctlResponse(Structure): |
no outgoing calls
no test coverage detected