Changeset 4891

Show
Ignore:
Timestamp:
05/09/07 07:39:37 (1 year ago)
Author:
hdm
Message:

This adds pass-the-hash support from grutz.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • framework3/tags/framework-3.0/lib/rex/proto/smb/client.rb

    r4315 r4891  
    569569                raise XCEPT::NTLM1MissingChallenge if not self.challenge_key 
    570570 
    571                 hash_lm = pass.length > 0 ? CRYPT.lanman_des(pass, self.challenge_key) : '' 
    572                 hash_nt = pass.length > 0 ? CRYPT.ntlm_md4(pass, self.challenge_key)   : '' 
     571                if (pass.length == 65) 
     572                        hash_lm = CRYPT.e_p24( [ pass.upcase()[0,32] ].pack('H42'), self.challenge_key) 
     573                        hash_nt = CRPYT.e_p24( [ pass.upcase()[33,65] ].pack('H42'), self.challenge_key) 
     574                else 
     575                        hash_lm = pass.length > 0 ? CRYPT.lanman_des(pass, self.challenge_key) : '' 
     576                        hash_nt = pass.length > 0 ? CRYPT.ntlm_md4(pass, self.challenge_key)   : '' 
     577                end 
    573578 
    574579                data = '' 
     
    691696 
    692697                # Generate the NTLM hash 
    693                 resp_ntlm = CRYPT.ntlm_md4(pass, nonce[0, 8]) 
     698                if (pass.length == 65) 
     699                        resp_ntlm = CRYPT.e_p24( [ pass.upcase()[33,65] ].pack('H42'), nonce[0, 8]) 
     700                else 
     701                        resp_ntlm = CRYPT.ntlm_md4(pass, nonce[0, 8]) 
     702                end 
    694703                 
    695704                # Generate the fake LANMAN hash