Class: MetasploitDataModels::IPAddress::V4::Segment::Nmap::List

Inherits:
Metasploit::Model::Base
  • Object
show all
Includes:
Match::Parent
Defined in:
app/models/metasploit_data_models/ip_address/v4/segment/nmap/list.rb

Overview

A comma separated list of segment numbers and range of segment numbers making up one segment of Nmap.

Constant Summary collapse

RANGE_OR_NUMBER_REGEXP =

Either an individual segment number or a segment range.

%r{
    (?<range>#{parent::Range.regexp})
    |
    # range first because it contains a segment and if the range isn't first only the first part of the range will
    # match.
    (?<number>#{MetasploitDataModels::IPAddress::V4::Segment::Single::REGEXP})
}x
SEPARATOR =

Separator between number or ranges

','
REGEXP =

Segment of an NMAP address, composed of comma separated segment numbers or ranges.

/#{RANGE_OR_NUMBER_REGEXP}(#{SEPARATOR}#{RANGE_OR_NUMBER_REGEXP})*/
MATCH_REGEXP =

Matches exactly an Nmap comma separated list of segment numbers and ranges.

/\A#{REGEXP}\z/

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Match::Parent

#match_child

Instance Attribute Details

#valueObject

Returns the value of attribute value.



38
39
40
# File 'app/models/metasploit_data_models/ip_address/v4/segment/nmap/list.rb', line 38

def value
  @value
end

Instance Method Details

#to_sString

Returns:

  • (String)


74
75
76
77
78
79
80
# File 'app/models/metasploit_data_models/ip_address/v4/segment/nmap/list.rb', line 74

def to_s
  if value.is_a? Array
    value.map(&:to_s).join(SEPARATOR)
  else
    value.to_s
  end
end