Class: RubySMB::SMB1::Packet::NegotiateRequest

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

Overview

A SMB1 SMB_COM_NEGOTIATE Request Packet as defined in 2.2.4.52.1

Defined Under Namespace

Classes: DataBlock

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, #initialize_instance, #packet_smb_version, read, #status_code, #valid?, walk_fields

Instance Method Details

#add_dialect(dialect_string) ⇒ BinData::Array

Add an individual Dialect string to the list of Dialects in the packet.

Parameters:

  • dialect_string (String)

    The string representing the Dialect to be negotiated

Returns:

  • (BinData::Array)

    A BinData array containing all the currently set dialects.



23
24
25
26
# File 'lib/ruby_smb/smb1/packet/negotiate_request.rb', line 23

def add_dialect(dialect_string)
  new_dialect = Dialect.new(dialect_string: dialect_string)
  data_block.dialects << new_dialect
end

#dialectsArray<Hash>

Returns the Dialects array as a normal Ruby Array.

Returns:

  • (Array<Hash>)

    array of the set dialects on the packet



31
32
33
# File 'lib/ruby_smb/smb1/packet/negotiate_request.rb', line 31

def dialects
  data_block.dialects.to_a
end

#set_dialects(dialect_array) ⇒ BinData::Array

Sets the entire list of dialects for the Negotiate Request.

Parameters:

  • dialect_array (Array<String>)

    An array of dialect strings to set on the packet

Returns:

  • (BinData::Array)

    A BinData array containing all the currently set dialects.



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

def set_dialects(dialect_array)
  data_block.dialects.clear
  dialect_array.each do |dialect_string|
    add_dialect(dialect_string)
  end
  data_block.dialects
end