Add cmd notes option to sort by column number
parent
5b2bbe7432
commit
4e49b99783
|
@ -923,6 +923,7 @@ class Db
|
||||||
print_line " -R,--rhosts Set RHOSTS from the results of the search"
|
print_line " -R,--rhosts Set RHOSTS from the results of the search"
|
||||||
print_line " -S,--search Search string to filter by"
|
print_line " -S,--search Search string to filter by"
|
||||||
print_line " -o,--output Save the notes to a csv file"
|
print_line " -o,--output Save the notes to a csv file"
|
||||||
|
print_line " -O <column> Order rows by specified column number"
|
||||||
print_line
|
print_line
|
||||||
print_line "Examples:"
|
print_line "Examples:"
|
||||||
print_line " notes --add -t apps -n 'winzip' 10.1.1.34 10.1.20.41"
|
print_line " notes --add -t apps -n 'winzip' 10.1.1.34 10.1.20.41"
|
||||||
|
@ -970,6 +971,11 @@ class Db
|
||||||
search_term = args.shift
|
search_term = args.shift
|
||||||
when '-o', '--output'
|
when '-o', '--output'
|
||||||
output_file = args.shift
|
output_file = args.shift
|
||||||
|
when '-O'
|
||||||
|
if (order_by = args.shift.to_i - 1) < 0
|
||||||
|
print_error('Please specify a column number starting from 1')
|
||||||
|
return
|
||||||
|
end
|
||||||
when '-u', '--update' # TODO: This is currently undocumented because it's not officially supported.
|
when '-u', '--update' # TODO: This is currently undocumented because it's not officially supported.
|
||||||
mode = :update
|
mode = :update
|
||||||
when '-h', '--help'
|
when '-h', '--help'
|
||||||
|
@ -1043,7 +1049,8 @@ class Db
|
||||||
table = Rex::Text::Table.new(
|
table = Rex::Text::Table.new(
|
||||||
'Header' => 'Notes',
|
'Header' => 'Notes',
|
||||||
'Indent' => 1,
|
'Indent' => 1,
|
||||||
'Columns' => ['Time', 'Host', 'Service', 'Port', 'Protocol', 'Type', 'Data']
|
'Columns' => ['Time', 'Host', 'Service', 'Port', 'Protocol', 'Type', 'Data'],
|
||||||
|
'SortIndex' => order_by
|
||||||
)
|
)
|
||||||
|
|
||||||
matched_note_ids = []
|
matched_note_ids = []
|
||||||
|
|
|
@ -177,6 +177,7 @@ RSpec.describe Msf::Ui::Console::CommandDispatcher::Db do
|
||||||
" -R,--rhosts Set RHOSTS from the results of the search",
|
" -R,--rhosts Set RHOSTS from the results of the search",
|
||||||
" -S,--search Search string to filter by",
|
" -S,--search Search string to filter by",
|
||||||
" -o,--output Save the notes to a csv file",
|
" -o,--output Save the notes to a csv file",
|
||||||
|
" -O <column> Order rows by specified column number",
|
||||||
"Examples:",
|
"Examples:",
|
||||||
" notes --add -t apps -n 'winzip' 10.1.1.34 10.1.20.41",
|
" notes --add -t apps -n 'winzip' 10.1.1.34 10.1.20.41",
|
||||||
" notes -t smb.fingerprint 10.1.1.34 10.1.20.41",
|
" notes -t smb.fingerprint 10.1.1.34 10.1.20.41",
|
||||||
|
|
Loading…
Reference in New Issue