Class: Watobo::NTLM::Message
Defined Under Namespace
Classes: Type0, Type1, Type2, Type3
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from FieldSet
#[], #[]=, #disable, #enable, #initialize, int16LE, int32LE, int64LE, names, opts, #parse, prototypes, security_buffer, string, types
Class Method Details
.decode64(str) ⇒ Object
595
596
597
|
# File 'lib/watobo/utils/ntlm.rb', line 595
def decode64(str)
parse(Base64.decode64(str))
end
|
.parse(str) ⇒ Object
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
|
# 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
|
Instance Method Details
#data_edge ⇒ Object
647
648
649
|
# 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 ⇒ Object
627
628
629
|
# 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) ⇒ Object
621
622
623
|
# File 'lib/watobo/utils/ntlm.rb', line 621
def decode64(str)
parse(Base64.decode64(str))
end
|
#deflag ⇒ Object
640
641
642
643
644
645
|
# 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 ⇒ Object
608
609
610
|
# File 'lib/watobo/utils/ntlm.rb', line 608
def dump_flags
FLAG_KEYS.each{ |k| print(k, "=", flag?(k), "\n") }
end
|
#encode64 ⇒ Object
617
618
619
|
# File 'lib/watobo/utils/ntlm.rb', line 617
def encode64
Base64.encode64(serialize).gsub(/\n/, '')
end
|
#has_flag?(flag) ⇒ Boolean
600
601
602
|
# File 'lib/watobo/utils/ntlm.rb', line 600
def has_flag?(flag)
(self[:flag].value & FLAGS[flag]) == FLAGS[flag]
end
|
#head_size ⇒ Object
625
|
# File 'lib/watobo/utils/ntlm.rb', line 625
alias head_size size
|
#security_buffers ⇒ Object
636
637
638
|
# File 'lib/watobo/utils/ntlm.rb', line 636
def security_buffers
@alist.find_all{|n, f| f.instance_of?(SecurityBuffer)}
end
|
#serialize ⇒ Object
612
613
614
615
|
# File 'lib/watobo/utils/ntlm.rb', line 612
def serialize
deflag
super + security_buffers.map{|n, f| f.value}.join
end
|
#set_flag(flag) ⇒ Object
604
605
606
|
# File 'lib/watobo/utils/ntlm.rb', line 604
def set_flag(flag)
self[:flag].value |= FLAGS[flag]
end
|
#size ⇒ Object
631
632
633
|
# File 'lib/watobo/utils/ntlm.rb', line 631
def size
head_size + data_size
end
|