Class: Metasploit::Model::Search::Operator::Deprecated::Author

Inherits:
Group::Union show all
Defined in:
app/models/metasploit/model/search/operator/deprecated/author.rb

Overview

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.

Instance Attribute Summary

Attributes inherited from Base

#klass

Instance Method Summary collapse

Methods inherited from Group::Base

#operate_on, operation_class, #operation_class, operation_class_name, operation_class_name!, operation_class_name=

Methods inherited from Metasploit::Model::Search::Operator::Delegation

#name, #operator, operator_name

Methods inherited from Base

#name

Methods included from Help

#help

Methods inherited from Base

#initialize, #valid!

Constructor Details

This class inherits a constructor from Metasploit::Model::Base

Instance Method Details

#children(formatted_value) ⇒ Array<Metasploit::Model::Search::Operation::Base>

Turns author: into Array of authors.name:, email_addresses.domain:, and email_addresses.local: 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.

Parameters:

  • formatted_value (String)

    value after ':' in formatted operation.

Returns:



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/models/metasploit/model/search/operator/deprecated/author.rb', line 12

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