Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/lib/rex/proto/gss/spnego_neg_token_init.rb
55805 views
1
require 'rasn1'
2
3
module Rex::Proto::Gss
4
# Initial negotiation token
5
# https://datatracker.ietf.org/doc/html/rfc4178#section-4.2
6
class MechType < RASN1::Types::ObjectId
7
end
8
9
class MechTypeList < RASN1::Model
10
sequence_of(:mech_type, Rex::Proto::Gss::MechType)
11
end
12
13
class ContextFlags < RASN1::Types::BitString
14
def initialize(options = {})
15
options[:bit_length] = 32
16
super
17
end
18
end
19
20
class NegTokenInit < RASN1::Model
21
sequence :neg_token_init, explicit: 0, class: :context, constructed: true,
22
content: [wrapper(model(:mech_type_list, Rex::Proto::Gss::MechTypeList), explicit: 0, constructed: true),
23
wrapper(model(:context_flags, Rex::Proto::Gss::ContextFlags), explicit: 1, constructed: true, optional: true),
24
octet_string(:mech_token, explicit: 2, constructed: true, optional: true),
25
octet_string(:mech_list_mic, explicit: 3, optional: true)
26
]
27
end
28
29
class SpnegoNegTokenInit < RASN1::Model
30
sequence :gssapi, implicit: 0, class: :application, constructed: true,
31
content: [objectid(:oid),
32
model(:neg_token_init, Rex::Proto::Gss::NegTokenInit)]
33
34
def mech_token
35
self[:gssapi][:neg_token_init][:mech_token].value
36
end
37
38
def mech_type_list
39
self[:gssapi][:neg_token_init][:mech_type_list][:mech_type]
40
end
41
end
42
end
43