class Metasploit::Model::Search::Operator::Base

Instead of writing an operator completely from scratch, you can subclass {Metasploit::Model::Search::Operator::Base}.

class MyOperator < Metasploit::Model::Search::Operator::Base
  # Name of this operator.  The name of the operator is matched to the string before the ':' in a formatted
  # operation.
  #
  # @return [Symbol]
  def name
    # ...
  end

  # Creates a one or more operations based on `formatted_value`.
  #
  # @return [#operator, Array<#operator>] Operation with this operator as the operation's `operator`.
  def operate_on(formatted_value)
    # ...
  end
end

Attributes

klass[RW]

@!attribute [rw] klass

The class on which this operator is usable.

@return [Class]

Public Instance Methods

name() click to toggle source

@abstract subclass and derive operator name from attributes of subclass.

Name of this operator.

@return [String] @raise [NotImplementedError]

# File app/models/metasploit/model/search/operator/base.rb, line 47
def name
  raise NotImplementedError
end