Sha256: e36ecf6e526ad8f70f25c6bc78e5c5f8d53262f9f3a9a27e895c497c7f2804a1

Contents?: true

Size: 1.12 KB

Versions: 3

Compression:

Stored size: 1.12 KB

Contents

# Translates `<name>:<value>` to the union of `platforms.name:<value>` and `targets.name:<value>` in order to support
# the `os` and `platform` operators.
class Metasploit::Model::Search::Operator::Deprecated::Platform < Metasploit::Model::Search::Operator::Union
  #
  # CONSTANTS
  #

  # Formatted operators that should be part of {#children} for this union.
  FORMATTED_OPERATORS = [
      'platforms.fully_qualified_name',
      'targets.name'
  ]

  #
  # Attributes
  #

  # @!attribute [rw] name
  #   Name of this operator
  #
  #   @return [Symbol]
  attr_accessor :name

  #
  # Validations
  #

  validates :name,
            :presence => true

  #
  # Methods
  #

  # Array of `platforms.fully_qualified_name:<formatted_value>` and `targets.name:<formatted_value>` operations.
  #
  # @param formatted_value [String] value parsed from formatted operation.
  # @return [Array<Metasploit::Model::Search::Operation::Base>]
  def children(formatted_value)
    FORMATTED_OPERATORS.collect { |formatted_operator|
      association_operator = operator(formatted_operator)
      association_operator.operate_on(formatted_value)
    }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
metasploit-model-0.24.1-java app/models/metasploit/model/search/operator/deprecated/platform.rb
metasploit-model-0.24.1 app/models/metasploit/model/search/operator/deprecated/platform.rb
metasploit-model-0.24.1.pre.semantic.pre.versioning.pre.2.pre.0 app/models/metasploit/model/search/operator/deprecated/platform.rb