Class: RubySMB::SMB2::Packet::NegotiateResponse
- Inherits:
-
GenericPacket
- Object
- BinData::Record
- GenericPacket
- RubySMB::SMB2::Packet::NegotiateResponse
- Defined in:
- lib/ruby_smb/smb2/packet/negotiate_response.rb
Overview
An SMB2 NEGOTIATE Response packet as defined by 2.2.4 SMB2 NEGOTIATE Response
Constant Summary collapse
Instance Method Summary collapse
-
#add_negotiate_context(nc) ⇒ Array<Integer>
Adds a Negotiate Context to the #negotiate_context_list.
-
#find_negotiate_context(type) ⇒ NegotiateContext
Find the first Negotiate Context structure that matches the given context type.
- #initialize_instance ⇒ Object
Methods inherited from GenericPacket
describe, #display, fields_hashed, format_field, from_hex, #packet_smb_version, read, #status_code, #valid?, walk_fields
Instance Method Details
#add_negotiate_context(nc) ⇒ Array<Integer>
Adds a Negotiate Context to the #negotiate_context_list
53 54 55 56 57 58 59 60 |
# File 'lib/ruby_smb/smb2/packet/negotiate_response.rb', line 53 def add_negotiate_context(nc) raise ArgumentError, 'Must be a NegotiateContext' unless nc.is_a? NegotiateContext previous_element = negotiate_context_list.last || negotiate_context_list pad_length = pad_length(previous_element) self.negotiate_context_list << nc self.negotiate_context_list.last.pad = "\x00" * pad_length self.negotiate_context_list end |
#find_negotiate_context(type) ⇒ NegotiateContext
Find the first Negotiate Context structure that matches the given context type
not found
44 45 46 |
# File 'lib/ruby_smb/smb2/packet/negotiate_response.rb', line 44 def find_negotiate_context(type) negotiate_context_list.find { |nc| nc.context_type == type } end |
#initialize_instance ⇒ Object
33 34 35 36 |
# File 'lib/ruby_smb/smb2/packet/negotiate_response.rb', line 33 def initialize_instance super smb2_header.flags.reply = 1 end |