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
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, #packet_smb_version, read, #status_code, walk_fields
Instance Method Details
#initialize_instance ⇒ Object
14 15 16 17 18 |
# File 'lib/ruby_smb/smb2/packet/query_directory_response.rb', line 14 def initialize_instance super smb2_header.command = RubySMB::SMB2::Commands::QUERY_DIRECTORY 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.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/ruby_smb/smb2/packet/query_directory_response.rb', line 26 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 information_classes << klass.read(data) end information_classes end |