Sha256: 4a96a1dad7b6b5d7ca648278d9325a7d5333476093ef30e988a977120fcf5755

Contents?: true

Size: 933 Bytes

Versions: 8

Compression:

Stored size: 933 Bytes

Contents

require 'metasploit/model/search/operator/deprecated'

# Emulates the deprecated `app` operator by converting it to the union of `authors.name:<value>`,
# `email_addresses.local<value before '@'>`, and `email_addresses.domain:<value before '@'>` in {#operate_on}.
class Metasploit::Model::Search::Operator::Deprecated::App < Metasploit::Model::Search::Operator::Delegation
  #
  # CONSTANTS
  #

  # Maps values passed to deprecated `app` operator to the equivalent value for the `stance` operator.
  STANCE_BY_APP = {
      'client' => 'passive',
      'server' => 'aggressive'
  }

  #
  # Methods
  #

  # Converts `app:client` to `stance:passive` and `app:server` to `stance:aggressive`.
  #
  # @return [Metasploit::Model::Search::Operation::Base]
  def operate_on(formatted_value)
    stance_value = STANCE_BY_APP[formatted_value]
    stance_operator = operator('stance')

    stance_operator.operate_on(stance_value)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
metasploit-model-0.27.3 app/models/metasploit/model/search/operator/deprecated/app.rb
metasploit-model-0.27.3-java app/models/metasploit/model/search/operator/deprecated/app.rb
metasploit-model-0.27.2 app/models/metasploit/model/search/operator/deprecated/app.rb
metasploit-model-0.27.2-java app/models/metasploit/model/search/operator/deprecated/app.rb
metasploit-model-0.27.1 app/models/metasploit/model/search/operator/deprecated/app.rb
metasploit-model-0.27.1-java app/models/metasploit/model/search/operator/deprecated/app.rb
metasploit-model-0.27.0 app/models/metasploit/model/search/operator/deprecated/app.rb
metasploit-model-0.27.0-java app/models/metasploit/model/search/operator/deprecated/app.rb