class MetasploitDataModels::Search::Operator::Port::List
Searches for a network port attribute. Ports can be given as a single number or range of numbers and either or both forms can be combined into a comma separated list. Individual port numbers are validated to be greater than 0 and
Constants
- SEPARATOR
Separates port number and/or port ranges
Attributes
attribute[W]
@!attribute [rw] attribute
Attribute holding port number. @return [Symbol] `:port`
Public Class Methods
operator_name()
click to toggle source
@note Can't be called `name` because it would alias `Class#name`
Name of this operator.
@return [String] `'port_list'`
# File app/models/metasploit_data_models/search/operator/port/list.rb, line 30 def self.operator_name 'port_list' end
Public Instance Methods
attribute()
click to toggle source
Defaults to `:port`.
@return [Symbol]
# File app/models/metasploit_data_models/search/operator/port/list.rb, line 41 def attribute @attribute ||= :port end
Also aliased as: name
children(formatted_value)
click to toggle source
Turns `{#attribute}:<number>,<range>` into the union of port <number> and port <range> searches.
@param formatted_value [String] comma separated list of port numbers and ranges. @return [Array<Metasploit::Model::Search::Operation::Base]
# File app/models/metasploit_data_models/search/operator/port/list.rb, line 49 def children(formatted_value) separated_formatted_values = formatted_value.split(SEPARATOR) separated_formatted_values.collect { |separated_formatted_value| operation_class = MetasploitDataModels::Search::Operation::Port::Number if separated_formatted_value.include? MetasploitDataModels::Search::Operation::Range::SEPARATOR operation_class = MetasploitDataModels::Search::Operation::Port::Range end operation_class.new( value: separated_formatted_value, operator: self ) } end