CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/lib/rex/post/meterpreter/extensions/priv/passwd.rb
Views: 11791
1
# -*- coding: binary -*-
2
3
module Rex
4
module Post
5
module Meterpreter
6
module Extensions
7
module Priv
8
9
###
10
#
11
# This class wraps a SAM hash entry.
12
#
13
###
14
class SamUser
15
16
#
17
# Initializes the class from a hash string like this:
18
#
19
# Administrator:500:aad3b435b51404eeaadfb435b51404ee:31d6cfe0d16de931b73c59d7e0c089c0:::
20
#
21
def initialize(hash_str)
22
self.user_name, self.user_id, self.lanman, self.ntlm = hash_str.split(/:/)
23
24
self.hash_string = hash_str
25
end
26
27
#
28
# Returns the hash string that was supplied to the constructor.
29
#
30
def to_s
31
hash_string
32
end
33
34
#
35
# The raw hash string that was passed to the class constructor.
36
#
37
attr_reader :hash_string
38
#
39
# The username from the SAM database entry.
40
#
41
attr_reader :user_name
42
#
43
# The user's unique identifier from the SAM database.
44
#
45
attr_reader :user_id
46
#
47
# The LM hash.
48
#
49
attr_reader :lanman
50
#
51
# The NTLM hash.
52
#
53
attr_reader :ntlm
54
55
protected
56
57
attr_writer :hash_string, :user_name, :user_id, :lanman, :ntlm # :nodoc:
58
59
end
60
61
end; end; end; end; end
62
63