Class: RubySMB::SMB1::Packet::Trans2::FindFirst2Response

Inherits:
GenericPacket
  • Object
show all
Includes:
Win9xFraming
Defined in:
lib/ruby_smb/smb1/packet/trans2/find_first2_response.rb

Overview

This class represents an SMB1 Trans2 FIND_FIRST2 Response Packet as defined in 2.2.6.2.2 Response

Defined Under Namespace

Classes: ParameterBlock

Constant Summary collapse

COMMAND =
RubySMB::SMB1::Commands::SMB_COM_TRANSACTION2

Instance Method Summary collapse

Methods included from Win9xFraming

#win9x_trans2_overrides

Methods inherited from GenericPacket

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

Instance Method Details

#initialize_instanceObject



55
56
57
58
59
# File 'lib/ruby_smb/smb1/packet/trans2/find_first2_response.rb', line 55

def initialize_instance
  super
  parameter_block.setup << RubySMB::SMB1::Packet::Trans2::Subcommands::FIND_FIRST2
  smb_header.flags.reply = 1
end

#results(klass, unicode:, buffer: nil) ⇒ array<BinData::Record>

Returns the File Information in an array of appropriate structs for the given FileInformationClass. Pulled out of the string buffer.

Info levels that carry a leading NextEntryOffset (e.g. FindFileFullDirectoryInfo) are framed by that field. Info levels without one (e.g. SMB_INFO_STANDARD, used by Win95/98/ME) are packed sequentially; each entry's length is derived from the record itself, and servers may insert an optional single NULL pad byte between entries (see MS-CIFS Appendix A, note <153>).

Parameters:

  • klass (Class)

    the FileInformationClass class to read the data as

  • buffer (String, nil) (defaults to: nil)

    raw trans2_data bytes to parse instead of the BinData-parsed buffer. Used by callers that detect a padding mismatch between BinData's expected layout and what a Win9x-era server actually sent (no 4-byte alignment pad before the data), and want to re-feed the bytes from the server-reported data_offset.

Returns:

  • (array<BinData::Record>)

    An array of structs holding the requested information

Raises:



80
81
82
83
84
85
86
87
# File 'lib/ruby_smb/smb1/packet/trans2/find_first2_response.rb', line 80

def results(klass, unicode:, buffer: nil)
  blob = (buffer || data_block.trans2_data.buffer.to_binary_s).dup
  if klass.new.respond_to?(:next_offset)
    read_next_offset_entries(klass, blob, unicode: unicode)
  else
    read_sequential_entries(klass, blob, unicode: unicode)
  end
end