class Watobo::NTLM::Message

@private false

Public Class Methods

decode64(str) click to toggle source
# File lib/watobo/utils/ntlm.rb, line 595
def decode64(str)
  parse(Base64.decode64(str))
end
parse(str) click to toggle source
# File lib/watobo/utils/ntlm.rb, line 579
def parse(str)
  m = Type0.new
  m.parse(str)
  case m.type
  when 1
    t = Type1.parse(str)
  when 2
    t = Type2.parse(str)
  when 3
    t = Type3.parse(str)
  else
    raise ArgumentError, "unknown type: #{m.type}"
  end
  t
end

Public Instance Methods

data_edge() click to toggle source
# File lib/watobo/utils/ntlm.rb, line 647
def data_edge
  security_buffers.map{ |n, f| f.active ? f.offset : size}.min
end
data_size() click to toggle source
# File lib/watobo/utils/ntlm.rb, line 627
def data_size
  security_buffers.inject(0){|sum, a| sum += a[1].data_size}
end
decode64(str) click to toggle source
# File lib/watobo/utils/ntlm.rb, line 621
def decode64(str)
  parse(Base64.decode64(str))
end
deflag() click to toggle source
# File lib/watobo/utils/ntlm.rb, line 640
def deflag
  security_buffers.inject(head_size){|cur, a|
    a[1].offset = cur
    cur += a[1].data_size
  }
end
dump_flags() click to toggle source
# File lib/watobo/utils/ntlm.rb, line 608
def dump_flags
  FLAG_KEYS.each{ |k| print(k, "=", flag?(k), "\n") }
end
encode64() click to toggle source
# File lib/watobo/utils/ntlm.rb, line 617
def encode64
  Base64.encode64(serialize).gsub(/\n/, '')
end
has_flag?(flag) click to toggle source
# File lib/watobo/utils/ntlm.rb, line 600
def has_flag?(flag)
  (self[:flag].value & FLAGS[flag]) == FLAGS[flag]
end
head_size()
Alias for: size
security_buffers() click to toggle source
# File lib/watobo/utils/ntlm.rb, line 636
def security_buffers
  @alist.find_all{|n, f| f.instance_of?(SecurityBuffer)}
end
serialize() click to toggle source
Calls superclass method Watobo::NTLM::FieldSet#serialize
# File lib/watobo/utils/ntlm.rb, line 612
def serialize
  deflag
  super + security_buffers.map{|n, f| f.value}.join
end
set_flag(flag) click to toggle source
# File lib/watobo/utils/ntlm.rb, line 604
def set_flag(flag)
  self[:flag].value  |= FLAGS[flag]
end
size() click to toggle source
# File lib/watobo/utils/ntlm.rb, line 631
def size
  head_size + data_size
end
Also aliased as: head_size