Skip to content

Commit 574ebd0

Browse files
committed
Update cmd_hosts
1 parent ad7b3da commit 574ebd0

File tree

1 file changed

+9
-2
lines changed
  • lib/msf/ui/console/command_dispatcher

1 file changed

+9
-2
lines changed

lib/msf/ui/console/command_dispatcher/db.rb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,11 @@ def cmd_hosts(*args)
360360
onlyup = true
361361
when '-o'
362362
output = args.shift
363+
when '-O'
364+
if (order_by = args.shift.to_i - 1) < 0
365+
print_error('Please specify a column number starting from 1')
366+
return
367+
end
363368
when '-R', '--rhosts'
364369
set_rhosts = true
365370
when '-S', '--search'
@@ -386,6 +391,7 @@ def cmd_hosts(*args)
386391
print_line " -h,--help Show this help information"
387392
print_line " -u,--up Only show hosts which are up"
388393
print_line " -o <file> Send output to a file in csv format"
394+
print_line " -O <column> Order rows by specified column number"
389395
print_line " -R,--rhosts Set RHOSTS from the results of the search"
390396
print_line " -S,--search Search string to filter by"
391397
print_line " -i,--info Change the info of a host"
@@ -425,8 +431,9 @@ def cmd_hosts(*args)
425431
# If we got here, we're searching. Delete implies search
426432
tbl = Rex::Text::Table.new(
427433
{
428-
'Header' => "Hosts",
429-
'Columns' => col_names,
434+
'Header' => "Hosts",
435+
'Columns' => col_names,
436+
'SortIndex' => order_by
430437
})
431438

432439
# Sentinal value meaning all

0 commit comments

Comments
 (0)