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

Class ComNegotiateResponse

pager_lib/smb/smb_structs.py:304–396  ·  view source on GitHub ↗

Contains information on the SMB_COM_NEGOTIATE response from server After calling the decode method, each instance will contain the following attributes, - security_mode (integer) - max_mpx_count (integer) - max_number_vcs (integer) - max_buffer_size (long) - max_raw_siz

Source from the content-addressed store, hash-verified

302
303
304class ComNegotiateResponse(Payload):
305 """
306 Contains information on the SMB_COM_NEGOTIATE response from server
307
308 After calling the decode method, each instance will contain the following attributes,
309 - security_mode (integer)
310 - max_mpx_count (integer)
311 - max_number_vcs (integer)
312 - max_buffer_size (long)
313 - max_raw_size (long)
314 - session_key (long)
315 - capabilities (long)
316 - system_time (long)
317 - server_time_zone (integer)
318 - challenge_length (integer)
319
320 If the underlying SMB message's flag2 does not have SMB_FLAGS2_EXTENDED_SECURITY bit enabled,
321 then the instance will have the following additional attributes,
322 - challenge (string)
323 - domain (unicode)
324
325 If the underlying SMB message's flags2 has SMB_FLAGS2_EXTENDED_SECURITY bit enabled,
326 then the instance will have the following additional attributes,
327 - server_guid (string)
328 - security_blob (string)
329
330 References:
331 ===========
332 - [MS-SMB]: 2.2.4.5.2.1
333 - [MS-CIFS]: 2.2.4.52.2
334 """
335
336 PAYLOAD_STRUCT_FORMAT = '<HBHHIIIIQHB'
337 PAYLOAD_STRUCT_SIZE = struct.calcsize(PAYLOAD_STRUCT_FORMAT)
338
339 def decode(self, message):
340 assert message.command == SMB_COM_NEGOTIATE
341
342 if not message.isReply:
343 raise ProtocolError('Not a SMB_COM_NEGOTIATE reply', message.raw_data, message)
344
345 self.security_mode, self.max_mpx_count, self.max_number_vcs, self.max_buffer_size, \
346 self.max_raw_size, self.session_key, self.capabilities, self.system_time, self.server_time_zone, \
347 self.challenge_length = ( 0, ) * 10
348
349 data_len = len(message.parameters_data)
350 if data_len < 2:
351 raise ProtocolError('Not enough data to decode SMB_COM_NEGOTIATE dialect_index field', message.raw_data, message)
352
353 self.dialect_index = struct.unpack('<H', message.parameters_data[:2])[0]
354 if self.dialect_index == NT_LAN_MANAGER_DIALECT:
355 if data_len != (0x11 * 2):
356 raise ProtocolError('NT LAN Manager dialect selected in SMB_COM_NEGOTIATE but parameters bytes count (%d) does not meet specs' % data_len,
357 message.raw_data, message)
358 else:
359 _, self.security_mode, self.max_mpx_count, self.max_number_vcs, self.max_buffer_size, \
360 self.max_raw_size, self.session_key, self.capabilities, self.system_time, self.server_time_zone, \
361 self.challenge_length = struct.unpack(self.PAYLOAD_STRUCT_FORMAT, message.parameters_data[:self.PAYLOAD_STRUCT_SIZE])

Callers 1

_decodePayloadMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected