class Ronin::Support::Network::ASN::Record
Represents an individual ASN
record.
Attributes
country_code[R]
The country code of the ASN
record.
@return [String, nil]
name[R]
The name of the ASN
record.
@return [String, nil]
number[R]
The ASN
number.
@return [Integer]
range[R]
The IP
range of the ASN
record.
@return [IPRange::CIDR, IPRange::Range
]
to_i[R]
The ASN
number.
@return [Integer]
Public Class Methods
new(number,range,country_code,name)
click to toggle source
Initializes the record.
@param [Integer] number
The ASN number.
@param [IPRange::CIDR, IPRange::Range
] range
The IP range of the ASN record.
@param [String, nil] country_code
The country code of the ASN record.
@param [String] name
The name of the ASN record.
# File lib/ronin/support/network/asn/record.rb, line 63 def initialize(number,range,country_code,name) @number = number @range = range @country_code = country_code @name = name end
Public Instance Methods
==(other)
click to toggle source
Compares the record to another object.
@param [Object] other
The other object to compare to.
@return [Boolean]
# File lib/ronin/support/network/asn/record.rb, line 140 def ==(other) self.class == other.class && @number == other.number && @range == other.range && @country_code == other.country_code && @name == other.name end
each(&block)
click to toggle source
include?(ip)
click to toggle source
ipv4?()
click to toggle source
ipv6?()
click to toggle source
not_routed?()
click to toggle source
Determines if the ASN
is not routed.
@return [Boolean]
# File lib/ronin/support/network/asn/record.rb, line 86 def not_routed? @number == 0 end
routed?()
click to toggle source
Determines if the ASN
is routed.
@return [Boolean]
# File lib/ronin/support/network/asn/record.rb, line 77 def routed? @number != 0 end
to_s()
click to toggle source
Converts the record into a humanly readable String
.
@return [String]
The String including the {#range}, {#number}, {#country_code}, and {#name}.
# File lib/ronin/support/network/asn/record.rb, line 155 def to_s if routed? "#{range} AS#{number} (#{country_code}) #{name}" else "#{range} Not routed" end end