Class: RubySMB::SMB1::Packet::NegotiateResponseExtended

Inherits:
GenericPacket
  • Object
show all
Defined in:
lib/ruby_smb/smb1/packet/negotiate_response_extended.rb

Overview

A SMB1 SMB_COM_NEGOTIATE Extended Security Response Packet as defined in 2.2.4.5.2.1 Extended Security Response

Defined Under Namespace

Classes: DataBlock, ParameterBlock

Constant Summary collapse

COMMAND =
RubySMB::SMB1::Commands::SMB_COM_NEGOTIATE

Instance Method Summary collapse

Methods inherited from GenericPacket

describe, #display, fields_hashed, format_field, from_hex, #packet_smb_version, read, #status_code, walk_fields

Instance Method Details

#dialects=(dialects) ⇒ Object

Stores the list of Dialect that were sent to the peer/server in the related Negotiate Request. This will be used by the #negotiated_dialect method.

Parameters:

  • dialects (Array)

    array of Dialect

Raises:

  • (ArgumentError)

    if dialects is not an array of Dialect



52
53
54
55
56
57
# File 'lib/ruby_smb/smb1/packet/negotiate_response_extended.rb', line 52

def dialects=(dialects)
  unless dialects.all? { |dialect| dialect.is_a? Dialect }
    raise ArgumentError, 'Dialects must be an array of Dialect objects'
  end
  @dialects = dialects
end

#initialize_instanceObject



34
35
36
37
# File 'lib/ruby_smb/smb1/packet/negotiate_response_extended.rb', line 34

def initialize_instance
  super
  smb_header.flags.reply = 1
end

#negotiated_dialectString

Returns the negotiated dialect identifier

Returns:

  • (String)

    the negotiated dialect identifier or an empty string if the list of Dialect was not provided.



62
63
64
65
# File 'lib/ruby_smb/smb1/packet/negotiate_response_extended.rb', line 62

def negotiated_dialect
  return '' if @dialects.nil? || @dialects.empty?
  @dialects[parameter_block.dialect_index].dialect_string
end

#valid?Boolean

Returns:

  • (Boolean)


39
40
41
42
43
# File 'lib/ruby_smb/smb1/packet/negotiate_response_extended.rb', line 39

def valid?
  return false unless super
  return false unless parameter_block.capabilities.extended_security == 1
  true
end