Sha256: 90c5373f76543427f7619a252ebb4d1689134c7467f96047f04a66535b72e6bd

Contents?: true

Size: 1.52 KB

Versions: 57

Compression:

Stored size: 1.52 KB

Contents

# Operator that emulates the behavior of 'author' operator that could search `Mdm::Module::Detail` by making
# {Metasploit::Model::Search::Operation::Group::Union} between `authors.name`, `email_addresss.domain`, and
# `email_addresses.local`.
class Metasploit::Model::Search::Operator::Deprecated::Author < Metasploit::Model::Search::Operator::Group::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

57 entries across 57 versions & 1 rubygems

Version Path
metasploit-model-5.0.2 app/models/metasploit/model/search/operator/deprecated/author.rb
metasploit-model-5.0.1 app/models/metasploit/model/search/operator/deprecated/author.rb
metasploit-model-5.0.0 app/models/metasploit/model/search/operator/deprecated/author.rb
metasploit-model-4.0.6 app/models/metasploit/model/search/operator/deprecated/author.rb
metasploit-model-4.0.5 app/models/metasploit/model/search/operator/deprecated/author.rb
metasploit-model-4.0.4 app/models/metasploit/model/search/operator/deprecated/author.rb
metasploit-model-4.0.3 app/models/metasploit/model/search/operator/deprecated/author.rb
metasploit-model-4.0.2 app/models/metasploit/model/search/operator/deprecated/author.rb
metasploit-model-4.0.1 app/models/metasploit/model/search/operator/deprecated/author.rb
metasploit-model-4.0.0 app/models/metasploit/model/search/operator/deprecated/author.rb
metasploit-model-3.1.4 app/models/metasploit/model/search/operator/deprecated/author.rb
metasploit-model-3.1.3 app/models/metasploit/model/search/operator/deprecated/author.rb
metasploit-model-3.1.2 app/models/metasploit/model/search/operator/deprecated/author.rb
metasploit-model-3.1.1 app/models/metasploit/model/search/operator/deprecated/author.rb
metasploit-model-3.1.0 app/models/metasploit/model/search/operator/deprecated/author.rb
metasploit-model-3.0.0 app/models/metasploit/model/search/operator/deprecated/author.rb
metasploit-model-2.0.4 app/models/metasploit/model/search/operator/deprecated/author.rb
metasploit-model-2.0.3 app/models/metasploit/model/search/operator/deprecated/author.rb
metasploit-model-2.0.2 app/models/metasploit/model/search/operator/deprecated/author.rb
metasploit-model-2.0.1 app/models/metasploit/model/search/operator/deprecated/author.rb