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

Class ComReadAndxRequest

pager_lib/smb/smb_structs.py:1131–1170  ·  view source on GitHub ↗

References: =========== - [MS-CIFS]: 2.2.4.42.1 - [MS-SMB]: 2.2.4.2.1

Source from the content-addressed store, hash-verified

1129
1130
1131class ComReadAndxRequest(Payload):
1132 """
1133 References:
1134 ===========
1135 - [MS-CIFS]: 2.2.4.42.1
1136 - [MS-SMB]: 2.2.4.2.1
1137 """
1138
1139 PAYLOAD_STRUCT_FORMAT = '<HIHHIHI'
1140 PAYLOAD_STRUCT_SIZE = struct.calcsize(PAYLOAD_STRUCT_FORMAT)
1141
1142 def __init__(self, fid, offset, max_return_bytes_count, min_return_bytes_count, timeout = 0, remaining = 0):
1143 """
1144 @param timeout: If reading from a regular file, this parameter must be 0.
1145 @type timeout: int
1146 """
1147 self.fid = fid
1148 self.remaining = remaining
1149 self.max_return_bytes_count = max_return_bytes_count
1150 self.min_return_bytes_count = min_return_bytes_count
1151 self.offset = offset
1152 self.timeout = timeout
1153
1154 def initMessage(self, message):
1155 Payload.initMessage(self, message)
1156 message.command = SMB_COM_READ_ANDX
1157
1158 def prepare(self, message):
1159 message.parameters_data = \
1160 self.DEFAULT_ANDX_PARAM_HEADER + \
1161 struct.pack(self.PAYLOAD_STRUCT_FORMAT,
1162 self.fid,
1163 self.offset & 0xFFFFFFFF,
1164 self.max_return_bytes_count,
1165 self.min_return_bytes_count,
1166 self.timeout or (self.max_return_bytes_count >> 32), # Note that in [MS-SMB]: 2.2.4.2.1, this field can also act as MaxCountHigh field
1167 self.remaining, # In [MS-CIFS]: 2.2.4.42.1, this field must be set to 0x0000
1168 self.offset >> 32)
1169
1170 message.data = b''
1171
1172
1173class ComReadAndxResponse(Payload):

Callers 2

sendReadRequestMethod · 0.85
sendReadMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected