Module: Metasploit::Model::Search::Attribute::ClassMethods

Defined in:
lib/metasploit/model/search/attribute.rb

Overview

Instance Method Summary collapse

Instance Method Details

#search_attribute(attribute, options = {}) ⇒ Metasploit::Model::Search::Operator::Base

Registers attribute for search. Help for the operator supports i18n.

Examples:

defining help

# lib/metasploit/model/module/instance.rb
module Metasploit::Model::Module::Instance
  include Metasploit::Model::Search

  included do
    search_attribute :description, :type => :string
  end
end

# config/locales/en.yml
en:
  metasploit:
    model:
      module:
        instance:
          search_attribute:
            description:
              help: "A long, paragraph description of what the module does."

Parameters:

  • attribute (#to_sym)

    name of attribute to search.

  • options (Hash{Symbol => String}) (defaults to: {})

Options Hash (options):

  • :type (Symbol)

    The type of the attribute. Used to determine how to parse the search values and which modifiers are supported.

Returns:

Raises:



42
43
44
45
46
# File 'lib/metasploit/model/search/attribute.rb', line 42

def search_attribute(attribute, options={})
  search_with Metasploit::Model::Search::Operator::Attribute,
              :attribute => attribute,
              :type => options[:type]
end