Sha256: 0568eddb17fbf03af69353cc004c2069f4193366adc2f686198ef3c5b0c9db3f

Contents?: true

Size: 1.51 KB

Versions: 3

Compression:

Stored size: 1.51 KB

Contents

# Operator that emulates the behavior of 'author' operator that could search `Mdm::Module::Detail` by making
# {Metasploit::Model::Search::Operation::Union} between `authors.name`, `email_addresss.domain`, and
# `email_addresses.local`.
class Metasploit::Model::Search::Operator::Deprecated::Author < Metasploit::Model::Search::Operator::Union
  # Turns author:<formatted_value> into Array of authors.name:<formatted_value>,
  # email_addresses.domain:<formatted_value>, and email_addresses.local:<formatted_value> operations.  If there is an
  # '@' in `formatted_value`, then the portion of `formatted_value` before the '@' is used for `email_addresses.local`
  # and the portion of `formatted_value` after the '@' is used for `email_addresses.domain`.
  #
  # @param formatted_value [String] value after ':' in formatted operation.
  # @return [Array<Metasploit::Model::Search::Operation::Base>]
  def children(formatted_value)
    operations = []

    authors_name_operator = operator('authors.name')
    operations << authors_name_operator.operate_on(formatted_value)

    if formatted_value.include? '@'
      local, domain = formatted_value.split('@', 2)
    else
      domain = formatted_value
      local = formatted_value
    end

    email_address_domain_operator = operator('email_addresses.domain')
    operations << email_address_domain_operator.operate_on(domain)

    email_addresses_local_operator = operator('email_addresses.local')
    operations << email_addresses_local_operator.operate_on(local)

    operations
  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/author.rb
metasploit-model-0.24.1 app/models/metasploit/model/search/operator/deprecated/author.rb
metasploit-model-0.24.1.pre.semantic.pre.versioning.pre.2.pre.0 app/models/metasploit/model/search/operator/deprecated/author.rb