Class: PacketGen::Plugin::SMB2::Negotiate::Context
- Inherits:
-
Types::Fields
- Object
- Types::Fields
- PacketGen::Plugin::SMB2::Negotiate::Context
- Defined in:
- lib/packetgen/plugin/smb2/negotiate/context.rb
Overview
NegotiateContext 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | DataLength |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Reserved |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Data (variable) |
+ +
| ... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Direct Known Subclasses
Constant Summary collapse
- TYPES =
Known types
{ 'PREAUTH_INTEGRITY_CAP' => 1, 'ENCRYPTION_CAP' => 2 }.freeze
Instance Attribute Summary collapse
-
#data ⇒ String
context data.
-
#data_length ⇒ Integer
16-bit data length.
-
#pad ⇒ String
Padding to align next context on a 8-byte offset.
-
#reserved ⇒ Integer
32-bit reserved field.
-
#type ⇒ Integer
16-bit context type.
Instance Method Summary collapse
-
#calc_length ⇒ Integer
Set #data_length field.
-
#human_type ⇒ String
Get human-readable type.
-
#to_human ⇒ String
Get human-readable context.
Instance Attribute Details
#data ⇒ String
context data
46 |
# File 'lib/packetgen/plugin/smb2/negotiate/context.rb', line 46 define_field :data, PacketGen::Types::String, builder: ->(h, t) { t.new(length_from: h[:data_length]) } |
#data_length ⇒ Integer
16-bit data length
38 |
# File 'lib/packetgen/plugin/smb2/negotiate/context.rb', line 38 define_field :data_length, PacketGen::Types::Int16le |
#pad ⇒ String
Padding to align next context on a 8-byte offset
50 |
# File 'lib/packetgen/plugin/smb2/negotiate/context.rb', line 50 define_field :pad, PacketGen::Types::String, builder: ->(h, t) { t.new(length_from: -> { 8 - (h.offset_of(:data) + h.data_length) % 8 }) } |
#reserved ⇒ Integer
32-bit reserved field
42 |
# File 'lib/packetgen/plugin/smb2/negotiate/context.rb', line 42 define_field :reserved, PacketGen::Types::Int32le |
Instance Method Details
#calc_length ⇒ Integer
Set #data_length field
69 70 71 72 |
# File 'lib/packetgen/plugin/smb2/negotiate/context.rb', line 69 def calc_length self[:pad].read SMB2::MAX_PADDING self.data_length = sz - self[:pad].sz - 8 end |
#human_type ⇒ String
Get human-readable type
57 58 59 |
# File 'lib/packetgen/plugin/smb2/negotiate/context.rb', line 57 def human_type self[:type].to_human end |
#to_human ⇒ String
Get human-readable context
63 64 65 |
# File 'lib/packetgen/plugin/smb2/negotiate/context.rb', line 63 def to_human human_type end |