filter search result using comma delimited fields

GSoC/Meterpreter_Web_Console
Erin Bleiweiss 2018-07-18 15:52:47 -05:00
parent 389b015047
commit 6955a9a58b
1 changed files with 14 additions and 1 deletions

View File

@ -5,7 +5,7 @@ module Msf::DBManager::Module
metadata = Msf::Modules::Metadata::Cache.instance.get_metadata
metadata.each { |module_metadata|
if is_match(module_metadata, opts)
search_results << module_metadata.full_name
search_results << get_fields(module_metadata, opts)
end
}
search_results
@ -56,5 +56,18 @@ module Msf::DBManager::Module
match
end
def get_fields(module_metadata, opts)
selected_fields = {}
if opts.key? :fields
fields = opts[:fields].split(',')
fields.each do | field |
if module_metadata.respond_to?(field)
selected_fields[field] = module_metadata.send(field)
end
end
end
selected_fields.empty? ? module_metadata : selected_fields
end
end