Class: PacketGen::Plugin::SMB2::SessionSetup::Response

Inherits:
Base
  • Object
show all
Defined in:
lib/packetgen/plugin/smb2/session_setup/response.rb

Overview

SMB2 SessionSetup request structure

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        StructureSize          |             Flags             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        BufferOffset           |           BufferLength        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                        Buffer (variable)                      |
+                                                               +
|                              ...                              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

define_smb2_pad_field

Instance Attribute Details

#bufferGSSAPI

Returns:



53
# File 'lib/packetgen/plugin/smb2/session_setup/response.rb', line 53

define_field :buffer, GSSAPI, token: :response, optional: ->(h) { h.buffer_offset.positive? }

#buffer_lengthInteger

The length of the #buffer field.

Returns:

  • (Integer)


50
# File 'lib/packetgen/plugin/smb2/session_setup/response.rb', line 50

define_field :buffer_length, PacketGen::Types::Int16le

#buffer_offsetInteger

The offset, from the beginning of the SMB2 header of the #buffer.

Returns:

  • (Integer)


46
# File 'lib/packetgen/plugin/smb2/session_setup/response.rb', line 46

define_field :buffer_offset, PacketGen::Types::Int16le, default: SMB2::HEADER_SIZE + 8

#flagsInteger

16-bit session flags

Returns:

  • (Integer)


32
# File 'lib/packetgen/plugin/smb2/session_setup/response.rb', line 32

define_field :flags, PacketGen::Types::Int16le

#flags_encrypt_data?Boolean

Returns:

  • (Boolean)


42
# File 'lib/packetgen/plugin/smb2/session_setup/response.rb', line 42

define_bit_fields_on :flags, :flags_rsv, 13, :flags_encrypt_data, :flags_is_null, :flags_is_guest

#flags_is_guest?Boolean

Returns:

  • (Boolean)


42
# File 'lib/packetgen/plugin/smb2/session_setup/response.rb', line 42

define_bit_fields_on :flags, :flags_rsv, 13, :flags_encrypt_data, :flags_is_null, :flags_is_guest

#flags_is_null?Boolean

Returns:

  • (Boolean)


42
# File 'lib/packetgen/plugin/smb2/session_setup/response.rb', line 42

define_bit_fields_on :flags, :flags_rsv, 13, :flags_encrypt_data, :flags_is_null, :flags_is_guest

#flags_rsvInteger

13-bit reserved field

Returns:

  • (Integer)


42
# File 'lib/packetgen/plugin/smb2/session_setup/response.rb', line 42

define_bit_fields_on :flags, :flags_rsv, 13, :flags_encrypt_data, :flags_is_null, :flags_is_guest

#structure_sizeInteger

16-bit session setup request structure size. Should be 9.

Returns:

  • (Integer)


28
# File 'lib/packetgen/plugin/smb2/session_setup/response.rb', line 28

define_field :structure_size, PacketGen::Types::Int16le, default: 9

Class Method Details

.protocol_nameString

Protocol name

Returns:

  • (String)


68
69
70
# File 'lib/packetgen/plugin/smb2/session_setup/response.rb', line 68

def self.protocol_name
  'SMB2::SessionSetup::Response'
end

Instance Method Details

#calc_lengthvoid

This method returns an undefined value.

Calculate and set #buffer_length and #buffer_offset fields.



57
58
59
60
61
62
63
64
# File 'lib/packetgen/plugin/smb2/session_setup/response.rb', line 57

def calc_length
  self.buffer_length = self[:buffer].sz
  self.buffer_offset = if self.buffer_length.zero?
                         0
                       else
                         SMB2.new.sz + offset_of(:buffer)
                       end
end