File tree Expand file tree Collapse file tree 2 files changed +131
-94
lines changed
ui/console/command_dispatcher Expand file tree Collapse file tree 2 files changed +131
-94
lines changed Original file line number Diff line number Diff line change 2
2
3
3
require 'rex/post/meterpreter/extensions/kiwi/tlv'
4
4
require 'rexml/document'
5
+ require 'set'
5
6
6
7
module Rex
7
8
module Post
@@ -283,9 +284,12 @@ def scrape_passwords(pwd_id)
283
284
request . add_tlv ( TLV_TYPE_KIWI_PWD_ID , pwd_id )
284
285
response = client . send_request ( request )
285
286
287
+ # keep track of unique entries
288
+ uniques = Set . new
289
+
286
290
results = [ ]
287
291
response . each ( TLV_TYPE_KIWI_PWD_RESULT ) do |r |
288
- results << {
292
+ result = {
289
293
:username => r . get_tlv_value ( TLV_TYPE_KIWI_PWD_USERNAME ) ,
290
294
:domain => r . get_tlv_value ( TLV_TYPE_KIWI_PWD_DOMAIN ) ,
291
295
:password => r . get_tlv_value ( TLV_TYPE_KIWI_PWD_PASSWORD ) ,
@@ -294,6 +298,17 @@ def scrape_passwords(pwd_id)
294
298
:lm => r . get_tlv_value ( TLV_TYPE_KIWI_PWD_LMHASH ) ,
295
299
:ntlm => r . get_tlv_value ( TLV_TYPE_KIWI_PWD_NTLMHASH )
296
300
}
301
+
302
+ # generate a "unique" set identifier based on the domain/user/pass. We
303
+ # don't use the whole object because the auth hi/low might be different
304
+ # but everything else might be the same. Join with non-printable, as this
305
+ # can't appear in passwords anyway.
306
+ set_id = [ result [ :domain ] , result [ :username ] , result [ :password ] ] . join ( "\x01 " )
307
+
308
+ # only add to the result list if we don't already have it
309
+ if uniques . add? ( set_id )
310
+ results << result
311
+ end
297
312
end
298
313
299
314
return results
You can’t perform that action at this time.
0 commit comments