Class: Rex::Post::Meterpreter::Extensions::Priv::SamUser

Inherits:
Object
  • Object
show all
Defined in:
lib/rex/post/meterpreter/extensions/priv/passwd.rb

Overview

This class wraps a SAM hash entry.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash_str) ⇒ SamUser

Initializes the class from a hash string like this:

Administrator:500:aad3b435b51404eeaadfb435b51404ee:31d6cfe0d16de931b73c59d7e0c089c0:


21
22
23
24
25
# File 'lib/rex/post/meterpreter/extensions/priv/passwd.rb', line 21

def initialize(hash_str)
  self.user_name, self.user_id, self.lanman, self.ntlm = hash_str.split(/:/)

  self.hash_string = hash_str
end

Instance Attribute Details

#hash_stringObject

The raw hash string that was passed to the class constructor.



37
38
39
# File 'lib/rex/post/meterpreter/extensions/priv/passwd.rb', line 37

def hash_string
  @hash_string
end

#lanmanObject

The LM hash.



49
50
51
# File 'lib/rex/post/meterpreter/extensions/priv/passwd.rb', line 49

def lanman
  @lanman
end

#ntlmObject

The NTLM hash.



53
54
55
# File 'lib/rex/post/meterpreter/extensions/priv/passwd.rb', line 53

def ntlm
  @ntlm
end

#user_idObject

The user’s unique identifier from the SAM database.



45
46
47
# File 'lib/rex/post/meterpreter/extensions/priv/passwd.rb', line 45

def user_id
  @user_id
end

#user_nameObject

The username from the SAM database entry.



41
42
43
# File 'lib/rex/post/meterpreter/extensions/priv/passwd.rb', line 41

def user_name
  @user_name
end

Instance Method Details

#to_sObject

Returns the hash string that was supplied to the constructor.



30
31
32
# File 'lib/rex/post/meterpreter/extensions/priv/passwd.rb', line 30

def to_s
  hash_string
end