Class: PacketGen::Plugin::SMB2::Negotiate::Response
- Defined in:
- lib/packetgen/plugin/smb2/negotiate/response.rb
Overview
SMB2 Negotiate response 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 | SecurityMode |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| DialectRevision | ContextCount |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| ServerGUID |
+ +
| |
+ +
| |
+ +
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Capabilities |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| MaxTranSize |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| MaxReadSize |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| MaxWriteSize |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| SystemTime |
+ +
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| StartTime |
+ +
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| BufferOffset | BufferLength |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| ContextOffset |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Buffer (variable) |
+ +
| ... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Pad (variable) |
+ +
| ... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| ContextList (variable) |
+ +
| ... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Instance Attribute Summary collapse
- #buffer ⇒ GSSAPI
-
#buffer_length ⇒ Integer
The length of the #buffer field.
-
#buffer_offset ⇒ Integer
The offset, from the beginning of the SMB2 header of the #buffer.
-
#cap_dfs ⇒ Boolean
Indicates if Distributed File system (DFS) is supported.
-
#cap_dir_leasing ⇒ Boolean
Indicates if directory leasing is supported.
-
#cap_encryption ⇒ Boolean
Indicates if encryption is supported.
-
#cap_large_mtu ⇒ Boolean
Indicates if multi credit operations are supported.
-
#cap_leasing ⇒ Boolean
Indicates if leasing is supported.
-
#cap_multi_channel ⇒ Boolean
Indicates if multiple channels are supported for a single session.
-
#cap_persistent_handles ⇒ Boolean
Indicates if persisten handles are supported.
-
#capabilities ⇒ Integer
32-bit capabilities field.
-
#context_count ⇒ Integer
Only for SMB3 dialect.
- #context_list ⇒ ArrayOfContext
-
#context_offset ⇒ Integer
Only for SMB3 dialect.
-
#dialect ⇒ Integer
16-bit prefered SMB2 protocol dialect number.
-
#max_read_size ⇒ Integer
32-bit value indicating the maximum size of a READ request.
-
#max_trans_size ⇒ Integer
32-bit value indicating the maximum size of the buffer used for QUERY_INFO, QUERY_DIRECTORY, SET_INFO and CHANGE_NOTIFY operations.
-
#max_write_size ⇒ Integer
32-bit value indicating the maximum size of a WRITE request.
-
#pad ⇒ Object
Optional padding between the end of the #buffer field and the first negotiate context in #context_list so that the first negotiate context is 8-byte aligned.
-
#security_mode ⇒ Integer
16-bit security mode field.
-
#server_guid ⇒ Object
[].
-
#start_time ⇒ SMB::Filetime
Start time of the SMB2 server.
-
#structure_size ⇒ Integer
16-bit negotiate request structure size.
-
#system_time ⇒ SMB::Filetime
System time of the SMB2 server.
Class Method Summary collapse
-
.protocol_name ⇒ String
Protocol name.
Instance Method Summary collapse
-
#calc_length ⇒ void
Calculate and set #context_offset, #buffer_offset, #buffer_length and #pad fields.
- #inspect ⇒ String
Methods inherited from Base
Instance Attribute Details
#buffer ⇒ GSSAPI
143 |
# File 'lib/packetgen/plugin/smb2/negotiate/response.rb', line 143 define_field :buffer, GSSAPI, token: :init, optional: ->(h) { h.buffer_offset.positive? } |
#buffer_length ⇒ Integer
The length of the #buffer field.
136 |
# File 'lib/packetgen/plugin/smb2/negotiate/response.rb', line 136 define_field :buffer_length, PacketGen::Types::Int16le |
#buffer_offset ⇒ Integer
The offset, from the beginning of the SMB2 header of the #buffer.
132 |
# File 'lib/packetgen/plugin/smb2/negotiate/response.rb', line 132 define_field :buffer_offset, PacketGen::Types::Int16le |
#cap_dfs ⇒ Boolean
Indicates if Distributed File system (DFS) is supported
105 106 107 |
# File 'lib/packetgen/plugin/smb2/negotiate/response.rb', line 105 define_bit_fields_on :capabilities, :cap_rsv, 25, :cap_encryption, :cap_dir_leasing, :cap_persistent_handles, :cap_multi_channel, :cap_large_mtu, :cap_leasing, :cap_dfs |
#cap_dir_leasing ⇒ Boolean
Indicates if directory leasing is supported
105 106 107 |
# File 'lib/packetgen/plugin/smb2/negotiate/response.rb', line 105 define_bit_fields_on :capabilities, :cap_rsv, 25, :cap_encryption, :cap_dir_leasing, :cap_persistent_handles, :cap_multi_channel, :cap_large_mtu, :cap_leasing, :cap_dfs |
#cap_encryption ⇒ Boolean
Indicates if encryption is supported
105 106 107 |
# File 'lib/packetgen/plugin/smb2/negotiate/response.rb', line 105 define_bit_fields_on :capabilities, :cap_rsv, 25, :cap_encryption, :cap_dir_leasing, :cap_persistent_handles, :cap_multi_channel, :cap_large_mtu, :cap_leasing, :cap_dfs |
#cap_large_mtu ⇒ Boolean
Indicates if multi credit operations are supported
105 106 107 |
# File 'lib/packetgen/plugin/smb2/negotiate/response.rb', line 105 define_bit_fields_on :capabilities, :cap_rsv, 25, :cap_encryption, :cap_dir_leasing, :cap_persistent_handles, :cap_multi_channel, :cap_large_mtu, :cap_leasing, :cap_dfs |
#cap_leasing ⇒ Boolean
Indicates if leasing is supported
105 106 107 |
# File 'lib/packetgen/plugin/smb2/negotiate/response.rb', line 105 define_bit_fields_on :capabilities, :cap_rsv, 25, :cap_encryption, :cap_dir_leasing, :cap_persistent_handles, :cap_multi_channel, :cap_large_mtu, :cap_leasing, :cap_dfs |
#cap_multi_channel ⇒ Boolean
Indicates if multiple channels are supported for a single session
105 106 107 |
# File 'lib/packetgen/plugin/smb2/negotiate/response.rb', line 105 define_bit_fields_on :capabilities, :cap_rsv, 25, :cap_encryption, :cap_dir_leasing, :cap_persistent_handles, :cap_multi_channel, :cap_large_mtu, :cap_leasing, :cap_dfs |
#cap_persistent_handles ⇒ Boolean
Indicates if persisten handles are supported
105 106 107 |
# File 'lib/packetgen/plugin/smb2/negotiate/response.rb', line 105 define_bit_fields_on :capabilities, :cap_rsv, 25, :cap_encryption, :cap_dir_leasing, :cap_persistent_handles, :cap_multi_channel, :cap_large_mtu, :cap_leasing, :cap_dfs |
#capabilities ⇒ Integer
32-bit capabilities field.
83 |
# File 'lib/packetgen/plugin/smb2/negotiate/response.rb', line 83 define_field :capabilities, PacketGen::Types::Int32le |
#context_count ⇒ Integer
Only for SMB3 dialect.
76 |
# File 'lib/packetgen/plugin/smb2/negotiate/response.rb', line 76 define_field :context_count, PacketGen::Types::Int16le |
#context_list ⇒ ArrayOfContext
154 |
# File 'lib/packetgen/plugin/smb2/negotiate/response.rb', line 154 define_field :context_list, ArrayOfContext, builder: ->(h, t) { t.new(counter: h[:context_count]) } |
#context_offset ⇒ Integer
Only for SMB3 dialect.
140 |
# File 'lib/packetgen/plugin/smb2/negotiate/response.rb', line 140 define_field :context_offset, PacketGen::Types::Int32le |
#dialect ⇒ Integer
16-bit prefered SMB2 protocol dialect number.
72 |
# File 'lib/packetgen/plugin/smb2/negotiate/response.rb', line 72 define_field :dialect, PacketGen::Types::Int16le |
#max_read_size ⇒ Integer
32-bit value indicating the maximum size of a READ request
116 |
# File 'lib/packetgen/plugin/smb2/negotiate/response.rb', line 116 define_field :max_read_size, PacketGen::Types::Int32le |
#max_trans_size ⇒ Integer
32-bit value indicating the maximum size of the buffer used for QUERY_INFO, QUERY_DIRECTORY, SET_INFO and CHANGE_NOTIFY operations.
112 |
# File 'lib/packetgen/plugin/smb2/negotiate/response.rb', line 112 define_field :max_trans_size, PacketGen::Types::Int32le |
#max_write_size ⇒ Integer
32-bit value indicating the maximum size of a WRITE request
120 |
# File 'lib/packetgen/plugin/smb2/negotiate/response.rb', line 120 define_field :max_write_size, PacketGen::Types::Int32le |
#pad ⇒ Object
Optional padding between the end of the #buffer field and the first negotiate context in #context_list so that the first negotiate context is 8-byte aligned
149 |
# File 'lib/packetgen/plugin/smb2/negotiate/response.rb', line 149 define_smb2_pad_field :pad |
#security_mode ⇒ Integer
16-bit security mode field.
68 |
# File 'lib/packetgen/plugin/smb2/negotiate/response.rb', line 68 define_field :security_mode, PacketGen::Types::Int16leEnum, enum: Negotiate::Request::SECURITY_MODES |
#server_guid ⇒ Object
Returns [].
79 |
# File 'lib/packetgen/plugin/smb2/negotiate/response.rb', line 79 define_field :server_guid, GUID |
#start_time ⇒ SMB::Filetime
Start time of the SMB2 server
128 |
# File 'lib/packetgen/plugin/smb2/negotiate/response.rb', line 128 define_field :start_time, SMB::Filetime |
#structure_size ⇒ Integer
16-bit negotiate request structure size. Should be 65.
64 |
# File 'lib/packetgen/plugin/smb2/negotiate/response.rb', line 64 define_field :structure_size, PacketGen::Types::Int16le, default: 65 |
#system_time ⇒ SMB::Filetime
System time of the SMB2 server
124 |
# File 'lib/packetgen/plugin/smb2/negotiate/response.rb', line 124 define_field :system_time, SMB::Filetime |
Class Method Details
.protocol_name ⇒ String
Protocol name
158 159 160 |
# File 'lib/packetgen/plugin/smb2/negotiate/response.rb', line 158 def self.protocol_name 'SMB2::Negotiate::Response' end |
Instance Method Details
#calc_length ⇒ void
This method returns an undefined value.
Calculate and set #context_offset, #buffer_offset, #buffer_length and #pad fields. Also calculate lengths in contexts.
184 185 186 187 188 189 190 191 192 193 194 195 196 197 |
# File 'lib/packetgen/plugin/smb2/negotiate/response.rb', line 184 def calc_length self[:pad].read SMB2::MAX_PADDING self.buffer_length = self[:buffer].sz self.buffer_offset = if self.buffer_length.zero? 0 else SMB2::HEADER_SIZE + offset_of(:buffer) end self.context_offset = 0 self.context_offset = SMB2::HEADER_SIZE + offset_of(:context_list) unless context_list.empty? context_list.each { |ctx| ctx.calc_length if ctx.respond_to? :calc_length } end |
#inspect ⇒ String
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
# File 'lib/packetgen/plugin/smb2/negotiate/response.rb', line 163 def inspect super do |attr| next unless attr == :capabilities value = bits_on(attr).reject { |_, v| v > 1 } .keys .select { |b| send("#{b}?") } .map(&:to_s) .join(',') .gsub!(/cap_/, '') value = '%-16s (0x%08x)' % [value, self[attr].to_i] str = PacketGen::Inspect.shift_level str << PacketGen::Inspect::FMT_ATTR % [self[attr].class.to_s.sub(/.*::/, ''), attr, value] end end |