@@ -29,22 +29,19 @@ def initialize(shell)
29
29
#
30
30
def commands
31
31
{
32
- "wdigest" => "Attempt to retrieve cleartext wdigest passwords " ,
33
- "msv" => "Attempt to retrieve hashes" ,
32
+ "wdigest" => "Attempt to retrieve wdigest creds " ,
33
+ "msv" => "Attempt to retrieve msv creds ( hashes) " ,
34
34
"livessp" => "Attempt to retrieve livessp creds" ,
35
35
"ssp" => "Attempt to retrieve ssp creds" ,
36
36
"tspkg" => "Attempt to retrieve tspkg creds" ,
37
37
"kerberos" => "Attempt to retrieve kerberos creds"
38
38
}
39
39
end
40
40
41
- def cmd_wdigest ( *args )
42
- unless system_check
43
- print_status ( "Attempting to get getprivs" )
44
- client . sys . config . getprivs
45
- end
46
- print_status ( "Retrieving passwords" )
47
- accounts = client . mimikatz . wdigest
41
+ def mimikatz_request ( provider , method )
42
+ get_privs
43
+ print_status ( "Retrieving #{ provider } credentials" )
44
+ accounts = method . call
48
45
49
46
table = Rex ::Ui ::Text ::Table . new (
50
47
'Indent' => 0 ,
@@ -63,139 +60,53 @@ def cmd_wdigest(*args)
63
60
64
61
return true
65
62
end
63
+
64
+ def cmd_wdigest ( *args )
65
+ method = Proc . new { client . mimikatz . wdigest }
66
+ mimikatz_request ( "wdigest" , method )
67
+ end
66
68
67
69
def cmd_msv ( *args )
68
- unless system_check
69
- print_status ( "Attempting to get getprivs" )
70
- client . sys . config . getprivs
71
- end
72
- print_status ( "Retrieving passwords" )
73
- accounts = client . mimikatz . msv
74
-
75
- table = Rex ::Ui ::Text ::Table . new (
76
- 'Indent' => 0 ,
77
- 'SortIndex' => 4 ,
78
- 'Columns' =>
79
- [
80
- 'AuthID' , 'Package' , 'Domain' , 'User' , 'Hash'
81
- ]
82
- )
83
-
84
- accounts . each do |acc |
85
- table << [ acc [ :authid ] , acc [ :package ] , acc [ :domain ] , acc [ :user ] , acc [ :password ] ]
86
- end
87
-
88
- table . print
89
-
90
- return true
70
+ method = Proc . new { client . mimikatz . msv }
71
+ mimikatz_request ( "msv" , method )
91
72
end
92
73
93
74
def cmd_livessp ( *args )
94
- unless system_check
95
- print_status ( "Attempting to getprivs" )
96
- client . sys . config . getprivs
97
- end
98
- print_status ( "Retrieving passwords" )
99
- accounts = client . mimikatz . livessp
100
-
101
- table = Rex ::Ui ::Text ::Table . new (
102
- 'Indent' => 0 ,
103
- 'SortIndex' => 4 ,
104
- 'Columns' =>
105
- [
106
- 'AuthID' , 'Package' , 'Domain' , 'User' , 'Password'
107
- ]
108
- )
109
-
110
- accounts . each do |acc |
111
- table << [ acc [ :authid ] , acc [ :package ] , acc [ :domain ] , acc [ :user ] , acc [ :password ] ]
112
- end
113
-
114
- table . print
115
-
116
- return true
75
+ method = Proc . new { client . mimikatz . livessp }
76
+ mimikatz_request ( "livessp" , method )
117
77
end
118
78
119
79
def cmd_ssp ( *args )
120
- unless system_check
121
- print_status ( "Attempting to getprivs" )
122
- client . sys . config . getprivs
123
- end
124
- print_status ( "Retrieving passwords" )
125
- accounts = client . mimikatz . ssp
126
-
127
- table = Rex ::Ui ::Text ::Table . new (
128
- 'Indent' => 0 ,
129
- 'SortIndex' => 4 ,
130
- 'Columns' =>
131
- [
132
- 'AuthID' , 'Package' , 'Domain' , 'User' , 'Password'
133
- ]
134
- )
135
-
136
- accounts . each do |acc |
137
- table << [ acc [ :authid ] , acc [ :package ] , acc [ :domain ] , acc [ :user ] , acc [ :password ] ]
138
- end
139
-
140
- table . print
141
-
142
- return true
143
- end
80
+ method = Proc . new { client . mimikatz . ssp }
81
+ mimikatz_request ( "ssp" , method )
82
+ end
144
83
145
84
def cmd_tspkg ( *args )
146
- unless system_check
147
- print_status ( "Attempting to getprivs" )
148
- client . sys . config . getprivs
149
- end
150
- print_status ( "Retrieving passwords" )
151
- accounts = client . mimikatz . tspkg
152
-
153
- table = Rex ::Ui ::Text ::Table . new (
154
- 'Indent' => 0 ,
155
- 'SortIndex' => 4 ,
156
- 'Columns' =>
157
- [
158
- 'AuthID' , 'Package' , 'Domain' , 'User' , 'Password'
159
- ]
160
- )
161
-
162
- accounts . each do |acc |
163
- table << [ acc [ :authid ] , acc [ :package ] , acc [ :domain ] , acc [ :user ] , acc [ :password ] ]
164
- end
165
-
166
- table . print
167
-
168
- return true
85
+ method = Proc . new { client . mimikatz . tspkg }
86
+ mimikatz_request ( "tspkg" , method )
169
87
end
170
88
171
89
def cmd_kerberos ( *args )
90
+ method = Proc . new { client . mimikatz . kerberos }
91
+ mimikatz_request ( "kerberos" , method )
92
+ end
93
+
94
+ def get_privs
172
95
unless system_check
173
96
print_status ( "Attempting to getprivs" )
174
- client . sys . config . getprivs
175
- end
176
- print_status ( "Retrieving passwords" )
177
- accounts = client . mimikatz . kerberos
178
-
179
- table = Rex ::Ui ::Text ::Table . new (
180
- 'Indent' => 0 ,
181
- 'SortIndex' => 4 ,
182
- 'Columns' =>
183
- [
184
- 'AuthID' , 'Package' , 'Domain' , 'User' , 'Password'
185
- ]
186
- )
187
-
188
- accounts . each do |acc |
189
- table << [ acc [ :authid ] , acc [ :package ] , acc [ :domain ] , acc [ :user ] , acc [ :password ] ]
190
- end
191
-
192
- table . print
193
-
194
- return true
195
- end
97
+ privs = client . sys . config . getprivs
98
+ unless privs . include? "SeDebugPrivilege"
99
+ print_warning ( "Did not get SeDebugPrivilege" )
100
+ else
101
+ print_good ( "Got SeDebugPrivilege" )
102
+ end
103
+ else
104
+ print_good ( "Running as SYSTEM" )
105
+ end
106
+ end
196
107
197
108
def system_check
198
- if ( client . sys . config . getuid ! = "NT AUTHORITY\\ SYSTEM" )
109
+ unless ( client . sys . config . getuid = = "NT AUTHORITY\\ SYSTEM" )
199
110
print_warning ( "Not currently running as SYSTEM" )
200
111
return false
201
112
end
@@ -216,3 +127,4 @@ def name
216
127
end
217
128
end
218
129
end
130
+
0 commit comments