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

Class ComTransaction2Request

pager_lib/smb/smb_structs.py:822–901  ·  view source on GitHub ↗

References: =========== - [MS-CIFS]: 2.2.4.46.1

Source from the content-addressed store, hash-verified

820
821
822class ComTransaction2Request(Payload):
823 """
824 References:
825 ===========
826 - [MS-CIFS]: 2.2.4.46.1
827 """
828
829 PAYLOAD_STRUCT_FORMAT = 'HHHHBBHIHHHHHH'
830 PAYLOAD_STRUCT_SIZE = struct.calcsize(PAYLOAD_STRUCT_FORMAT)
831
832 def __init__(self, max_params_count, max_data_count, max_setup_count,
833 total_params_count = 0, total_data_count = 0,
834 params_bytes = b'', data_bytes = b'', setup_bytes = b'',
835 flags = 0, timeout = 0):
836 self.total_params_count = total_params_count or len(params_bytes)
837 self.total_data_count = total_data_count or len(data_bytes)
838 self.max_params_count = max_params_count
839 self.max_data_count = max_data_count
840 self.max_setup_count = max_setup_count
841 self.flags = flags
842 self.timeout = timeout
843 self.params_bytes = params_bytes
844 self.data_bytes = data_bytes
845 self.setup_bytes = setup_bytes
846
847 def initMessage(self, message):
848 Payload.initMessage(self, message)
849 message.command = SMB_COM_TRANSACTION2
850
851 def prepare(self, message):
852 setup_bytes_len = len(self.setup_bytes)
853 params_bytes_len = len(self.params_bytes)
854 data_bytes_len = len(self.data_bytes)
855 name = b'\0\0'
856
857 padding0 = b''
858 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)
859 if offset % 2 != 0:
860 padding0 = b'\0'
861 offset += 1
862
863 offset += 2 # For the name field
864 padding1 = b''
865 if offset % 4 != 0:
866 padding1 = b'\0'*(4-offset%4)
867
868 if params_bytes_len > 0:
869 params_bytes_offset = offset
870 offset += params_bytes_len
871 else:
872 params_bytes_offset = 0
873
874 padding2 = b''
875 if offset % 4 != 0:
876 padding2 = b'\0'*(4-offset%4)
877
878 if data_bytes_len > 0:
879 data_bytes_offset = offset

Callers 4

sendFindFirstMethod · 0.85
sendFindNextMethod · 0.85
sendDFSReferralMethod · 0.85
sendQueryMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected