Class: NTLM::Message::Negotiate

Inherits:
NTLM::Message show all
Defined in:
lib/ntlm/message.rb

Overview

MS-NLMP

2.2.1.1

Constant Summary collapse

TYPE =
1
ATTRIBUTES =
[:domain, :workstation, :version]
DEFAULT_FLAGS =
[NEGOTIATE_UNICODE, NEGOTIATE_OEM, REQUEST_TARGET, NEGOTIATE_NTLM, NEGOTIATE_ALWAYS_SIGN, NEGOTIATE_EXTENDED_SECURITY].inject(:|)

Constants inherited from NTLM::Message

AV_PAIRS, AV_PAIR_NAMES, FLAGS, SSP_SIGNATURE

Constants included from Util

Util::LM_MAGIC_TEXT

Instance Attribute Summary

Attributes inherited from NTLM::Message

#flag

Instance Method Summary collapse

Methods inherited from NTLM::Message

#clear, #has_flag?, #initialize, #inspect, #inspect_flags, parse, #serialize_to_base64, #set, #to_s, #unicode?

Methods included from Util

create_des_keys, #decode_utf16, #encode_utf16, encrypt, lm_v1_hash, nt_v1_hash, nt_v2_hash, ntlm_v1_response, ntlm_v2_response

Constructor Details

This class inherits a constructor from NTLM::Message

Instance Method Details

#parse(string) ⇒ Object



209
210
211
212
213
214
215
216
# File 'lib/ntlm/message.rb', line 209

def parse(string)
  super
  @flag, domain, workstation, version = string.unpack('x12Va8a8a8')
  @domain      = fetch_payload(domain) if has_flag?(:OEM_DOMAIN_SUPPLIED)
  @workstation = fetch_payload(workstation) if has_flag?(:OEM_WORKSTATION_SUPPLIED)
  @version     = decode_version(version)  if has_flag?(:NEGOTIATE_VERSION)
  self
end

#serializeObject



218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
# File 'lib/ntlm/message.rb', line 218

def serialize
  @buffer = ''
  @offset = 40  # (8 + 4) + 4 + (8 * 3)

  if @domain
    set(:OEM_DOMAIN_SUPPLIED)
    domain = append_payload(@domain)
  end

  if @workstation
    set(:OEM_WORKSTATION_SUPPLIED)
    workstation = append_payload(@workstation)
  end

  if @version
    set(:NEGOTIATE_VERSION)
    version = encode_version(@version)
  end

  [SSP_SIGNATURE, TYPE, @flag, domain, workstation, version].pack('a8VVa8a8a8') + @buffer
end