diff --git a/lib/msf/core/exploit/remote/ldap/queries.rb b/lib/msf/core/exploit/remote/ldap/queries.rb index 0104de4d92..26dedf0eeb 100755 --- a/lib/msf/core/exploit/remote/ldap/queries.rb +++ b/lib/msf/core/exploit/remote/ldap/queries.rb @@ -53,12 +53,22 @@ module Msf tbl = Rex::Text::Table.new( 'Header' => entry[:dn].first, 'Indent' => 1, - 'Columns' => %w[Name Attributes] + 'Columns' => %w[Name Attributes], + 'ColProps' => { 'Name' => { 'Strip' => false } }, + 'SortIndex' => -1, + 'WordWrap' => false ) - entry.each_key do |attr| + entry.keys.sort.each do |attr| if format == 'table' - tbl << [attr, entry[attr].join(' || ')] unless attr == :dn # Skip over DN entries for tables since DN information is shown in header. + next if attr == :dn # Skip over DN entries for tables since DN information is shown in header. + + tbl << [attr, entry[attr].first] + if entry[attr].length > 1 + entry[attr][1...].each do |additional_attr| + tbl << [ ' \\_', additional_attr] + end + end else tbl << [attr, entry[attr].join(' || ')] # DN information is not shown in CSV output as a header so keep DN entries in. end