@@ -400,16 +400,15 @@ def self.dump_options(mod, indent = '', missing = false)
400
400
'Description'
401
401
] )
402
402
403
- mod . options . sorted . each { |entry |
404
- name , opt = entry
403
+ mod . options . sorted . each do |name , opt |
405
404
val = mod . datastore [ name ] || opt . default
406
405
407
406
next if ( opt . advanced? )
408
407
next if ( opt . evasion? )
409
408
next if ( missing && opt . valid? ( val ) )
410
409
411
410
tbl << [ name , opt . display_value ( val ) , opt . required? ? "yes" : "no" , opt . desc ]
412
- }
411
+ end
413
412
414
413
return tbl . to_s
415
414
end
@@ -420,24 +419,23 @@ def self.dump_options(mod, indent = '', missing = false)
420
419
# @param indent [String] the indentation to use.
421
420
# @return [String] the string form of the information.
422
421
def self . dump_advanced_options ( mod , indent = '' )
423
- output = ''
424
- pad = indent
425
-
426
- mod . options . sorted . each { |entry |
427
- name , opt = entry
428
-
429
- next if ( !opt . advanced? )
430
-
431
- val = mod . datastore [ name ] || opt . default . to_s
432
- desc = word_wrap ( opt . desc , indent . length + 3 )
433
- desc = desc . slice ( indent . length + 3 , desc . length )
422
+ tbl = Rex ::Ui ::Text ::Table . new (
423
+ 'Indent' => indent . length ,
424
+ 'Columns' =>
425
+ [
426
+ 'Name' ,
427
+ 'Current Setting' ,
428
+ 'Required' ,
429
+ 'Description'
430
+ ] )
434
431
435
- output << pad + "Name : #{ name } \n "
436
- output << pad + "Current Setting: #{ val } \n "
437
- output << pad + "Description : #{ desc } \n "
438
- }
432
+ mod . options . sorted . each do |name , opt |
433
+ next unless opt . advanced?
434
+ val = mod . datastore [ name ] || opt . default
435
+ tbl << [ name , opt . display_value ( val ) , opt . required? ? "yes" : "no" , opt . desc ]
436
+ end
439
437
440
- return output
438
+ return tbl . to_s
441
439
end
442
440
443
441
# Dumps the evasion options associated with the supplied module.
@@ -446,25 +444,23 @@ def self.dump_advanced_options(mod, indent = '')
446
444
# @param indent [String] the indentation to use.
447
445
# @return [String] the string form of the information.
448
446
def self . dump_evasion_options ( mod , indent = '' )
449
- output = ''
450
- pad = indent
451
-
452
- mod . options . sorted . each { |entry |
453
- name , opt = entry
454
-
455
- next if ( !opt . evasion? )
456
-
457
- val = mod . datastore [ name ] || opt . default || ''
458
-
459
- desc = word_wrap ( opt . desc , indent . length + 3 )
460
- desc = desc . slice ( indent . length + 3 , desc . length )
447
+ tbl = Rex ::Ui ::Text ::Table . new (
448
+ 'Indent' => indent . length ,
449
+ 'Columns' =>
450
+ [
451
+ 'Name' ,
452
+ 'Current Setting' ,
453
+ 'Required' ,
454
+ 'Description'
455
+ ] )
461
456
462
- output << pad + "Name : #{ name } \n "
463
- output << pad + "Current Setting: #{ val } \n "
464
- output << pad + "Description : #{ desc } \n "
465
- }
457
+ mod . options . sorted . each do |name , opt |
458
+ next unless opt . evasion?
459
+ val = mod . datastore [ name ] || opt . default
460
+ tbl << [ name , opt . display_value ( val ) , opt . required? ? "yes" : "no" , opt . desc ]
461
+ end
466
462
467
- return output
463
+ return tbl . to_s
468
464
end
469
465
470
466
# Dumps the references associated with the supplied module.
0 commit comments