Class: RubySMB::SMB2::Packet::QueryDirectoryResponse
- Inherits:
-
GenericPacket
- Object
- BinData::Record
- GenericPacket
- RubySMB::SMB2::Packet::QueryDirectoryResponse
- Defined in:
- lib/ruby_smb/smb2/packet/query_directory_response.rb
Overview
An SMB2 Query Directory Response Packet as defined in 2.2.34 SMB2 QUERY_DIRECTORY Response
Constant Summary collapse
- COMMAND =
RubySMB::SMB2::Commands::QUERY_DIRECTORY
Instance Method Summary collapse
- #initialize_instance ⇒ Object
-
#results(klass) ⇒ array<BinData::Record>
Returns the File Information in an array of appropriate structs for the given FileInformationClass.
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_instance ⇒ Object
16 17 18 19 |
# File 'lib/ruby_smb/smb2/packet/query_directory_response.rb', line 16 def initialize_instance super smb2_header.flags.reply = 1 end |
#results(klass) ⇒ array<BinData::Record>
Returns the File Information in an array of appropriate structs for the given FileInformationClass. Pulled out of the string buffer.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/ruby_smb/smb2/packet/query_directory_response.rb', line 28 def results(klass) information_classes = [] blob = buffer.to_binary_s.dup until blob.empty? length = blob[0, 4].unpack('V').first data = if length.zero? blob.slice!(0, blob.length) else blob.slice!(0, length) end begin information_classes << klass.read(data) rescue IOError raise RubySMB::Error::InvalidPacket, "Invalid #{klass} File Information in the string buffer" end end information_classes end |