Module: Msf::WebServices::ModuleSearch

Included in:
Msf::WebServices
Defined in:
lib/msf/core/web_services/module_search.rb

Instance Method Summary collapse

Instance Method Details

#search_modules(opts) ⇒ Object

Raises:

  • (::ArgumentError)


3
4
5
6
7
8
9
10
11
12
# File 'lib/msf/core/web_services/module_search.rb', line 3

def search_modules(opts)
  raise ::ArgumentError, "At least one search parameter must be provided." if opts.except(:fields).empty?
  params = parse_params(opts)
  fields = parse_fields(opts)
  begin
    Msf::Modules::Metadata::Cache.instance.find(params, fields)
  rescue ArgumentError
    raise ::ArgumentError, "Invalid search parameter(s) provided."
  end
end