From cd0a806a0663a573e2edc6032b1e037100eaa09c Mon Sep 17 00:00:00 2001 From: James Lee Date: Thu, 2 Feb 2012 12:10:27 -0700 Subject: [PATCH] Sort by filename instead of the default first column [Fixes 6336] --- .../meterpreter/ui/console/command_dispatcher/stdapi/fs.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/fs.rb b/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/fs.rb index 9553f46798..bac96d5ee9 100644 --- a/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/fs.rb +++ b/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/fs.rb @@ -307,6 +307,7 @@ class Console::CommandDispatcher::Stdapi::Fs path = args[0] || client.fs.dir.getwd tbl = Rex::Ui::Text::Table.new( 'Header' => "Listing: #{path}", + 'SortIndex' => 4, 'Columns' => [ 'Mode', @@ -319,7 +320,8 @@ class Console::CommandDispatcher::Stdapi::Fs items = 0 # Enumerate each item... - client.fs.dir.entries_with_info(path).sort { |a,b| a['FileName'] <=> b['FileName'] }.each { |p| + # No need to sort as Table will do it for us + client.fs.dir.entries_with_info(path).each { |p| tbl << [