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

Class ComOpenAndxRequest

pager_lib/smb/smb_structs.py:981–1025  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

979
980
981class ComOpenAndxRequest(Payload):
982 """
983 References:
984 ===========
985 - [MS-CIFS]: 2.2.4.41.1
986 """
987
988 PAYLOAD_STRUCT_FORMAT = '<HHHHIHIII'
989 PAYLOAD_STRUCT_SIZE = struct.calcsize(PAYLOAD_STRUCT_FORMAT)
990
991 def __init__(self, filename, access_mode, open_mode, flags = 0x0000, search_attributes = 0, file_attributes = 0, create_time = 0, timeout = 0):
992 """
993 @param create_time: Epoch time value to indicate the time of creation for this file. If zero, we will automatically assign the current time
994 @type create_time: int
995 @param timeout: Number of milliseconds to wait for blocked open request before failing
996 @type timeout: int
997 """
998 self.filename = filename
999 self.access_mode = access_mode
1000 self.open_mode = open_mode
1001 self.flags = flags
1002 self.search_attributes = search_attributes
1003 self.file_attributes = file_attributes
1004 self.create_time = create_time or int(time.time())
1005 self.timeout = timeout
1006
1007 def initMessage(self, message):
1008 Payload.initMessage(self, message)
1009 message.command = SMB_COM_OPEN_ANDX
1010
1011 def prepare(self, message):
1012 message.parameters_data = \
1013 self.DEFAULT_ANDX_PARAM_HEADER + \
1014 struct.pack(self.PAYLOAD_STRUCT_FORMAT,
1015 self.flags,
1016 self.access_mode,
1017 self.search_attributes,
1018 self.file_attributes,
1019 self.create_time,
1020 self.open_mode,
1021 0, # AllocationSize
1022 0, # Timeout (in milli-secs)
1023 0) # Reserved
1024
1025 message.data = b'\0' + self.filename.encode('UTF-16LE') + b'\0\0'
1026
1027
1028class ComOpenAndxResponse(Payload):

Callers 1

sendOpenMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected