Add -O (order_by) to services (cmd_services)

bug/bundler_fix
William Vu 2016-12-12 14:14:00 -06:00
parent 7aa743b205
commit b9e9d97479
1 changed files with 9 additions and 2 deletions

View File

@ -586,6 +586,11 @@ class Db
return
end
output_file = ::File.expand_path(output_file)
when '-O'
if (order_by = args.shift.to_i - 1) == -1
print_error('Please specify a column number starting from 1')
return
end
when '-R', '--rhosts'
set_rhosts = true
when '-S', '--search'
@ -604,6 +609,7 @@ class Db
print_line " -r <protocol> Only show [tcp|udp] services"
print_line " -u,--up Only show services which are up"
print_line " -o <file> Send output to a file in csv format"
print_line " -O <column> Order rows by specified column number"
print_line " -R,--rhosts Set RHOSTS from the results of the search"
print_line " -S,--search Search string to filter by"
print_line
@ -651,8 +657,9 @@ class Db
col_names = col_search
end
tbl = Rex::Text::Table.new({
'Header' => "Services",
'Columns' => ['host'] + col_names,
'Header' => "Services",
'Columns' => ['host'] + col_names,
'SortIndex' => order_by
})
# Sentinal value meaning all