Class: Watobo::NTLM::Message::Type2
Class Method Summary
collapse
Instance Method Summary
collapse
#data_edge, #data_size, decode64, #decode64, #deflag, #dump_flags, #encode64, #has_flag?, #head_size, #security_buffers, #serialize, #set_flag, #size
Methods inherited from FieldSet
#[], #[]=, #disable, #enable, #initialize, int16LE, int32LE, int64LE, names, opts, prototypes, security_buffer, #serialize, #size, string, types
Class Method Details
.parse(str) ⇒ Type2
708
709
710
711
712
|
# File 'lib/watobo/utils/ntlm.rb', line 708
def parse(str)
t = new
t.parse(str)
t
end
|
Instance Method Details
#challenge ⇒ Int64
699
|
# File 'lib/watobo/utils/ntlm.rb', line 699
int64LE :challenge, {:value => 0}
|
#challenge= ⇒ Int64
699
|
# File 'lib/watobo/utils/ntlm.rb', line 699
int64LE :challenge, {:value => 0}
|
#context ⇒ Int64
700
|
# File 'lib/watobo/utils/ntlm.rb', line 700
int64LE :context, {:value => 0, :active => false}
|
#context= ⇒ Int64
700
|
# File 'lib/watobo/utils/ntlm.rb', line 700
int64LE :context, {:value => 0, :active => false}
|
698
|
# File 'lib/watobo/utils/ntlm.rb', line 698
int32LE :flag, {:value => DEFAULT_FLAGS[:TYPE2]}
|
698
|
# File 'lib/watobo/utils/ntlm.rb', line 698
int32LE :flag, {:value => DEFAULT_FLAGS[:TYPE2]}
|
702
|
# File 'lib/watobo/utils/ntlm.rb', line 702
string :padding, {:size => 0, :value => "", :active => false }
|
702
|
# File 'lib/watobo/utils/ntlm.rb', line 702
string :padding, {:size => 0, :value => "", :active => false }
|
#response(arg, opt = {}) ⇒ Type3
Note:
An empty :domain option authenticates to the local machine.
Note:
The :use_default_target has presidence over the :domain option
Generates a Type 3 response based on the Type 2 Information
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
|
# File 'lib/watobo/utils/ntlm.rb', line 738
def response(arg, opt = {})
usr = arg[:user]
pwd = arg[:password]
domain = arg[:domain] ? arg[:domain] : ""
if usr.nil? or pwd.nil?
raise ArgumentError, "user and password have to be supplied"
end
if opt[:workstation]
ws = opt[:workstation]
else
ws = Socket.gethostname
end
if opt[:client_challenge]
cc = opt[:client_challenge]
else
cc = rand(MAX64)
end
cc = NTLM::pack_int64le(cc) if cc.is_a?(Integer)
opt[:client_challenge] = cc
if has_flag?(:OEM) and opt[:unicode]
usr = NTLM::EncodeUtil.decode_utf16le(usr)
pwd = NTLM::EncodeUtil.decode_utf16le(pwd)
ws = NTLM::EncodeUtil.decode_utf16le(ws)
domain = NTLM::EncodeUtil.decode_utf16le(domain)
opt[:unicode] = false
end
if has_flag?(:UNICODE) and !opt[:unicode]
usr = NTLM::EncodeUtil.encode_utf16le(usr)
pwd = NTLM::EncodeUtil.encode_utf16le(pwd)
ws = NTLM::EncodeUtil.encode_utf16le(ws)
domain = NTLM::EncodeUtil.encode_utf16le(domain)
opt[:unicode] = true
end
if opt[:use_default_target]
domain = self.target_name
end
ti = self.target_info
chal = self[:challenge].serialize
if opt[:ntlmv2]
ar = {:ntlmv2_hash => NTLM::ntlmv2_hash(usr, pwd, domain, opt), :challenge => chal, :target_info => ti}
lm_res = NTLM::lmv2_response(ar, opt)
ntlm_res = NTLM::ntlmv2_response(ar, opt)
elsif has_flag?(:NTLM2_KEY)
ar = {:ntlm_hash => NTLM::ntlm_hash(pwd, opt), :challenge => chal}
lm_res, ntlm_res = NTLM::ntlm2_session(ar, opt)
else
lm_res = NTLM::lm_response(pwd, chal)
ntlm_res = NTLM::ntlm_response(pwd, chal)
end
Type3.create({
:lm_response => lm_res,
:ntlm_response => ntlm_res,
:domain => domain,
:user => usr,
:workstation => ws,
:flag => self.flag
})
end
|
695
|
# File 'lib/watobo/utils/ntlm.rb', line 695
string :sign, {:size => 8, :value => SSP_SIGN}
|
695
|
# File 'lib/watobo/utils/ntlm.rb', line 695
string :sign, {:size => 8, :value => SSP_SIGN}
|
701
|
# File 'lib/watobo/utils/ntlm.rb', line 701
security_buffer :target_info, {:value => "", :active => false}
|
701
|
# File 'lib/watobo/utils/ntlm.rb', line 701
security_buffer :target_info, {:value => "", :active => false}
|
697
|
# File 'lib/watobo/utils/ntlm.rb', line 697
security_buffer :target_name, {:size => 0, :value => ""}
|
697
|
# File 'lib/watobo/utils/ntlm.rb', line 697
security_buffer :target_name, {:size => 0, :value => ""}
|
696
|
# File 'lib/watobo/utils/ntlm.rb', line 696
int32LE :type, {:value => 2}
|
696
|
# File 'lib/watobo/utils/ntlm.rb', line 696
int32LE :type, {:value => 2}
|