Class: MetasploitDataModels::Search::Operator::Port::List
- Inherits:
-
Metasploit::Model::Search::Operator::Group::Union
- Object
- Metasploit::Model::Search::Operator::Group::Union
- MetasploitDataModels::Search::Operator::Port::List
- Defined in:
- app/models/metasploit_data_models/search/operator/port/list.rb
Overview
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
Constant Summary collapse
- SEPARATOR =
Separates port number and/or port ranges
','
Instance Attribute Summary collapse
-
#attribute ⇒ Symbol
(also: #name)
Defaults to
:port
.
Class Method Summary collapse
-
.operator_name ⇒ String
Name of this operator.
Instance Method Summary collapse
-
#children(formatted_value) ⇒ Array<Metasploit::Model::Search::Operation::Base]
Turns
{#attribute}:<number>,<range>
into the union of portand port searches.
Instance Attribute Details
#attribute ⇒ Symbol Also known as: name
Defaults to :port
.
19 |
# File 'app/models/metasploit_data_models/search/operator/port/list.rb', line 19 attr_writer :attribute |
Class Method Details
.operator_name ⇒ String
Note:
Can't be called name
because it would alias Class#name
Name of this operator.
30 31 32 |
# File 'app/models/metasploit_data_models/search/operator/port/list.rb', line 30 def self.operator_name 'port_list' end |
Instance Method Details
#children(formatted_value) ⇒ Array<Metasploit::Model::Search::Operation::Base]
Turns {#attribute}:<number>,<range>
into the union of port
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# 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 |