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

Method prepare

pager_lib/smb/smb_structs.py:559–574  ·  view source on GitHub ↗
(self, message)

Source from the content-addressed store, hash-verified

557 message.command = SMB_COM_TREE_CONNECT_ANDX
558
559 def prepare(self, message):
560 password_len = len(self.password)
561 message.parameters_data = \
562 self.DEFAULT_ANDX_PARAM_HEADER + \
563 struct.pack(self.PAYLOAD_STRUCT_FORMAT,
564 0x08 | \
565 ((message.hasExtendedSecurity and 0x0004) or 0x00) | \
566 ((message.tid and message.tid != 0xffff and 0x0001) or 0x00), # Disconnect tid, if message.tid must be non-zero
567 password_len)
568
569 padding = b''
570 if password_len % 2 == 0:
571 padding = b'\0'
572
573 # Note that service field is never encoded in UTF-16LE. [MS-CIFS]: 2.2.1.1
574 message.data = self.password.encode('UTF-8') + padding + self.path.encode('UTF-16LE') + b'\0\0' + self.service.encode('UTF-8') + b'\0'
575
576
577class ComTreeConnectAndxResponse(Payload):

Callers

nothing calls this directly

Calls 1

encodeMethod · 0.45

Tested by

no test coverage detected