class Ronin::Support::Network::ASN::DNSRecord

Represents a DNS record returned by [Team Cymru’s ASN rDNS service].

[1]: team-cymru.com/community-services/ip-asn-mapping/

Public Class Methods

new(number,range,country_code) 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.
Calls superclass method
# File lib/ronin/support/network/asn/dns_record.rb, line 48
def initialize(number,range,country_code)
  super(number,range,country_code,nil)
end

Public Instance Methods

date() click to toggle source

The date the ASN record was registered.

@return [Date]

@note

Calling this method for the first time will lazy query
`AS<nnn>.asn.cymru.com` for the additional ASN information.
# File lib/ronin/support/network/asn/dns_record.rb, line 89
def date
  query_additional_info! if @date.nil?
  return @date
end
name() click to toggle source

The name of the ASN record.

@return [String]

@note

Calling this method for the first time will lazy query
`AS<nnn>.asn.cymru.com` for the additional ASN information.
# File lib/ronin/support/network/asn/dns_record.rb, line 61
def name
  query_additional_info! if @name.nil?
  return @name
end
registry() click to toggle source

The registry’s name of the ASN record.

@return [String]

@note

Calling this method for the first time will lazy query
`AS<nnn>.asn.cymru.com` for the additional ASN information.
# File lib/ronin/support/network/asn/dns_record.rb, line 75
def registry
  query_additional_info! if @registry.nil?
  return @registry
end

Private Instance Methods

query_additional_info!() click to toggle source

Queries the additional information for the AS number.

# File lib/ronin/support/network/asn/dns_record.rb, line 99
def query_additional_info!
  string = DNS.get_txt_string("AS#{@number}.asn.cymru.com")

  _, _, @registry, @date, @name = string.split(' | ',5)

  @date = Date.parse(@date)
  @name.chomp!(", #{country_code}")
end