module Ronin::Support::Network::DNS

@since 0.4.0

Constants

IDN

Supports [International Domain Names (IDN)].

[IDN]: en.wikipedia.org/wiki/Internationalized_domain_name

@api public

@since 1.0.0

Public Class Methods

get_a_address(name,**kwargs) click to toggle source

Queries the first IPv4 address belonging to the host name.

@param [String] name

The host name to query.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [String, nil]

The first IPv4 address belonging to the host name.
# File lib/ronin/support/network/dns.rb, line 426
def self.get_a_address(name,**kwargs)
  resolver(**kwargs).get_a_address(name.to_s)
end
get_a_addresses(name,**kwargs) click to toggle source

Queries all IPv4 addresses belonging to the host name.

@param [String] name

The host name to query.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [Array<String>]

All of the IPv4 addresses belonging to the host name.
# File lib/ronin/support/network/dns.rb, line 494
def self.get_a_addresses(name,**kwargs)
  resolver(**kwargs).get_a_addresses(name.to_s)
end
get_a_record(name,**kwargs) click to toggle source

Queries the first ‘A` record belonging to the host name.

@param [String] name

The host name to query.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [Resolv::DNS::Resource::IN::A, nil]

The first `A` DNS record or `nil` if the host name has no `A`
records.

@see rubydoc.info/stdlib/resolv/Resolv/DNS/Resource/IN/A

# File lib/ronin/support/network/dns.rb, line 404
def self.get_a_record(name,**kwargs)
  resolver(**kwargs).get_a_record(name.to_s)
end
get_a_records(name,**kwargs) click to toggle source

Queries all ‘A` records belonging to the host name.

@param [String] name

The host name to query.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [Array<Resolv::DNS::Resource::IN::A>]

All of the `A` DNS records belonging to the host name.

@see rubydoc.info/stdlib/resolv/Resolv/DNS/Resource/IN/A

# File lib/ronin/support/network/dns.rb, line 472
def self.get_a_records(name,**kwargs)
  resolver(**kwargs).get_a_records(name.to_s)
end
get_aaaa_address(name,**kwargs) click to toggle source

Queries the first IPv6 address belonging to the host name.

@param [String] name

The host name to query.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [String, nil]

The first IPv6 address or `nil` if the host name has no IPv6
addresses.
# File lib/ronin/support/network/dns.rb, line 564
def self.get_aaaa_address(name,**kwargs)
  resolver(**kwargs).get_aaaa_address(name.to_s)
end
get_aaaa_addresses(name,**kwargs) click to toggle source

Queries all IPv6 addresses belonging to the host name.

@param [String] name

The host name to query.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [Array<String>]

All IPv6 addresses belonging to the host name.
# File lib/ronin/support/network/dns.rb, line 633
def self.get_aaaa_addresses(name,**kwargs)
  resolver(**kwargs).get_aaaa_addresses(name.to_s)
end
get_aaaa_record(name,**kwargs) click to toggle source

Queries the first ‘AAAA` DNS records belonging to the host name.

@param [String] name

The host name to query.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [Resolv::DNS::Resource::IN::AAAA, nil]

The first `AAAA` DNS record or `nil` if the host name has no
`AAAA` records.

@see rubydoc.info/stdlib/resolv/Resolv/DNS/Resource/IN/AAAA

# File lib/ronin/support/network/dns.rb, line 541
def self.get_aaaa_record(name,**kwargs)
  resolver(**kwargs).get_aaaa_record(name.to_s)
end
get_aaaa_records(name,**kwargs) click to toggle source

Queries all ‘AAAA` DNS records belonging to the host name.

@param [String] name

The host name to query.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [Array<Resolv::DNS::Resource::IN::AAAA>]

All of the `AAAA` DNS records belonging to the host name.

@see rubydoc.info/stdlib/resolv/Resolv/DNS/Resource/IN/AAAA

# File lib/ronin/support/network/dns.rb, line 611
def self.get_aaaa_records(name,**kwargs)
  resolver(**kwargs).get_aaaa_records(name.to_s)
end
get_address(host,**kwargs) click to toggle source

Looks up the address of a hostname.

@param [String] host

The hostname to lookup.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [String, nil]

The address of the hostname.

@api public

# File lib/ronin/support/network/dns.rb, line 119
def self.get_address(host,**kwargs)
  resolver(**kwargs).get_address(host.to_s)
end
get_addresses(host,**kwargs) click to toggle source

Looks up all addresses of a hostname.

@param [String] host

The hostname to lookup.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [Array<String>]

The addresses of the hostname.

@api public

# File lib/ronin/support/network/dns.rb, line 161
def self.get_addresses(host,**kwargs)
  resolver(**kwargs).get_addresses(host.to_s)
end
get_any_records(name,**kwargs) click to toggle source

Queries all records of the host name using the ‘ANY` DNS query.

@param [String] name

The host name to query.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [Array<Resolv::DNS::Resource>]

All of the DNS records belonging to the host name.

@see rubydoc.info/stdlib/resolv/Resolv/DNS/Resource/ANY

# File lib/ronin/support/network/dns.rb, line 306
def self.get_any_records(name,**kwargs)
  resolver(**kwargs).get_any_records(name.to_s)
end
get_cname(name,**kwargs) click to toggle source

Queries the canonical name for the host name.

@param [String] name

The host name to query.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [String, nil]

The canonical name for the host or `nil` if the host has no
`CNAME` record.
# File lib/ronin/support/network/dns.rb, line 354
def self.get_cname(name,**kwargs)
  resolver(**kwargs).get_cname(name.to_s)
end
get_cname_record(name,**kwargs) click to toggle source

Queries the ‘CNAME` record for the host name.

@param [String] name

The host name to query.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [Resolv::DNS::Resource::IN::CNAME, nil]

The `CNAME` record or `nil` if the host name has no `CNAME`
record.

@see rubydoc.info/stdlib/resolv/Resolv/DNS/Resource/CNAME

# File lib/ronin/support/network/dns.rb, line 331
def self.get_cname_record(name,**kwargs)
  resolver(**kwargs).get_cname_record(name.to_s)
end
get_hinfo_record(name,**kwargs) click to toggle source

Queries the ‘HINFO` record for the host name.

@param [String] name

The host name to query.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [Resolv::DNS::Resource::IN::HINFO, nil]

The `HINFO` DNS record or `nil` if the host name has no `HINFO`
record.

@see rubydoc.info/stdlib/resolv/Resolv/DNS/Resource/HINFO

# File lib/ronin/support/network/dns.rb, line 379
def self.get_hinfo_record(name,**kwargs)
  resolver(**kwargs).get_hinfo_record(name.to_s)
end
get_ip_address(name,**kwargs) click to toggle source

Queries the first IPv4 or IPv6 address belonging to the host name.

@param [String] name

The host name to query.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [String, nil]

The first IPv4 or IPv6 address or `nil` if the host name has no
IPv4 or IPv6 addresses.
# File lib/ronin/support/network/dns.rb, line 678
def self.get_ip_address(name,**kwargs)
  resolver(**kwargs).get_ip_address(name.to_s)
end
get_ip_addresses(name,**kwargs) click to toggle source

Queries all IP addresses belonging to the host name.

@param [String] name

The host name to query.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [Array<String>]

All IPv4 or IPv6 addresses belonging to the host name.
# File lib/ronin/support/network/dns.rb, line 700
def self.get_ip_addresses(name,**kwargs)
  resolver(**kwargs).get_ip_addresses(name.to_s)
end
get_ipv4_address(name,**kwargs) click to toggle source

Queries the first IPv4 address belonging to the host name.

@param [String] name

The host name to query.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [String, nil]

The first IPv4 address belonging to the host name.
# File lib/ronin/support/network/dns.rb, line 448
def self.get_ipv4_address(name,**kwargs)
  resolver(**kwargs).get_ipv4_address(name.to_s)
end
get_ipv4_addresses(name,**kwargs) click to toggle source

Queries all IPv4 addresses belonging to the host name.

@param [String] name

The host name to query.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [Array<String>]

All of the IPv4 addresses belonging to the host name.
# File lib/ronin/support/network/dns.rb, line 516
def self.get_ipv4_addresses(name,**kwargs)
  resolver(**kwargs).get_ipv4_addresses(name.to_s)
end
get_ipv6_address(name,**kwargs) click to toggle source

Queries the first IPv6 address belonging to the host name.

@param [String] name

The host name to query.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [String, nil]

The first IPv6 address or `nil` if the host name has no IPv6
addresses.
# File lib/ronin/support/network/dns.rb, line 587
def self.get_ipv6_address(name,**kwargs)
  resolver(**kwargs).get_ipv6_address(name.to_s)
end
get_ipv6_addresses(name,**kwargs) click to toggle source

Queries all IPv6 addresses belonging to the host name.

@param [String] name

The host name to query.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [Array<String>]

All IPv6 addresses belonging to the host name.
# File lib/ronin/support/network/dns.rb, line 655
def self.get_ipv6_addresses(name,**kwargs)
  resolver(**kwargs).get_ipv6_addresses(name.to_s)
end
get_loc_record(name,**kwargs) click to toggle source

Queries the ‘LOC` (Location) DNS record of the host name.

@param [String] name

The host name to query.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [Resolv::DNS::Resource::LOC, nil]

The `LOC` DNS record of the host name or `nil` if the host name
has no `LOC` record.

@see rubydoc.info/stdlib/resolv/Resolv/DNS/Resource/LOC

# File lib/ronin/support/network/dns.rb, line 774
def self.get_loc_record(name,**kwargs)
  resolver(**kwargs).get_loc_record(name.to_s)
end
get_mailservers(name,**kwargs) click to toggle source

Queries the mailservers for the host name.

@param [String] name

The host name to query.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [Array<String>]

The host names of the mailservers serving the given host name.
# File lib/ronin/support/network/dns.rb, line 845
def self.get_mailservers(name,**kwargs)
  resolver(**kwargs).get_mailservers(name.to_s)
end
get_minfo_record(name,**kwargs) click to toggle source

Queries the ‘MINFO` (Machine-Info) DNS record of the host name.

@param [String] name

The host name to query.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [Resolv::DNS::Resource::MINFO, nil]

The `MINFO` DNS record of the host name or `nil` if the host name
has no `MINFO` record.

@see rubydoc.info/stdlib/resolv/Resolv/DNS/Resource/MINFO

# File lib/ronin/support/network/dns.rb, line 799
def self.get_minfo_record(name,**kwargs)
  resolver(**kwargs).get_minfo_record(name.to_s)
end
get_mx_records(name,**kwargs) click to toggle source

Queries all ‘MX` DNS records belonging to the host name.

@param [String] name

The host name to query.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [Array<Resolv::DNS::Resource::MX>]

All `MX` DNS records belonging to the host name.

@see rubydoc.info/stdlib/resolv/Resolv/DNS/Resource/MX

# File lib/ronin/support/network/dns.rb, line 823
def self.get_mx_records(name,**kwargs)
  resolver(**kwargs).get_mx_records(name.to_s)
end
get_name(ip,**kwargs) click to toggle source

Looks up the hostname of the address.

@param [String] ip

The IP address to lookup.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [String, nil]

The hostname of the address.

@api public

# File lib/ronin/support/network/dns.rb, line 185
def self.get_name(ip,**kwargs)
  resolver(**kwargs).get_name(ip.to_s)
end
get_names(ip,**kwargs) click to toggle source

Looks up all hostnames associated with the address.

@param [String] ip

The IP address to lookup.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [Array<String>]

The hostnames of the address.

@api public

# File lib/ronin/support/network/dns.rb, line 227
def self.get_names(ip,**kwargs)
  resolver(**kwargs).get_names(ip.to_s)
end
get_nameservers(name,**kwargs) click to toggle source

Queries the nameservers for the host name.

@param [String] name

The host name to query.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [Array<String>]

The host names of the nameservers serving the given host name.
# File lib/ronin/support/network/dns.rb, line 891
def self.get_nameservers(name,**kwargs)
  resolver(**kwargs).get_nameservers(name.to_s)
end
get_ns_records(name,**kwargs) click to toggle source

Queries all ‘NS` DNS records belonging to the host name.

@param [String] name

The host name to query.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [Array<Resolv::DNS::Resource::NS>]

All `NS` DNS records belonging to the host name.

@see rubydoc.info/stdlib/resolv/Resolv/DNS/Resource/NS

# File lib/ronin/support/network/dns.rb, line 869
def self.get_ns_records(name,**kwargs)
  resolver(**kwargs).get_ns_records(name.to_s)
end
get_ptr_name(ip,**kwargs) click to toggle source

Queries the ‘PTR` host name for the IP address.

@param [String] ip

The IP address to query.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [String, nil]

The host name that points to the given IP.
# File lib/ronin/support/network/dns.rb, line 938
def self.get_ptr_name(ip,**kwargs)
  resolver(**kwargs).get_ptr_name(ip.to_s)
end
get_ptr_names(ip,**kwargs) click to toggle source

Queries all ‘PTR` names for the IP address.

@param [String] ip

The IP address to query.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [Array<String>]

The `PTR` names for the given IP.
# File lib/ronin/support/network/dns.rb, line 984
def self.get_ptr_names(ip,**kwargs)
  resolver(**kwargs).get_ptr_names(ip.to_s)
end
get_ptr_record(ip,**kwargs) click to toggle source

Queries the first ‘PTR` DNS record for the IP address.

@param [String] ip

The IP address to query.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [Resolv::DNS::Resource::PTR, nil]

The first `PTR` DNS record of the host name or `nil` if the host
name has no `PTR` records.

@see rubydoc.info/stdlib/resolv/Resolv/DNS/Resource/PTR

# File lib/ronin/support/network/dns.rb, line 916
def self.get_ptr_record(ip,**kwargs)
  resolver(**kwargs).get_ptr_record(ip.to_s)
end
get_ptr_records(ip,**kwargs) click to toggle source

Queries all ‘PTR` DNS records for the IP address.

@param [String] ip

The IP address to query.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [Array<Resolv::DNS::Resource::PTR>]

All `PTR` DNS records for the given IP.

@see rubydoc.info/stdlib/resolv/Resolv/DNS/Resource/PTR

# File lib/ronin/support/network/dns.rb, line 962
def self.get_ptr_records(ip,**kwargs)
  resolver(**kwargs).get_ptr_records(ip.to_s)
end
get_record(name,record_type,**kwargs) click to toggle source

Queries a single matching DNS record for the host name.

@param [String] name

The host name to query.

@param [:a, :aaaa, :any, :cname, :hinfo, :loc, :minfo, :mx, :ns, :ptr, :soa, :srv, :txt, :wks] record_type

The record type.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [Resolv::DNS::Resource, nil]

The matching DNS records or `nil` if no matching DNS records
could be found.

@see rubydoc.info/stdlib/resolv/Resolv/DNS/Resource

# File lib/ronin/support/network/dns.rb, line 255
def self.get_record(name,record_type,**kwargs)
  resolver(**kwargs).get_record(name.to_s,record_type)
end
get_records(name,record_type,**kwargs) click to toggle source

Queries all matching DNS records for the host name.

@param [String] name

The host name to query.

@param [:a, :aaaa, :any, :cname, :hinfo, :loc, :minfo, :mx, :ns, :ptr, :soa, :srv, :txt, :wks] record_type

The record type.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [Array<Resolv::DNS::Resource>]

All matching DNS records.

@see rubydoc.info/stdlib/resolv/Resolv/DNS/Resource

# File lib/ronin/support/network/dns.rb, line 282
def self.get_records(name,record_type,**kwargs)
  resolver(**kwargs).get_records(name.to_s,record_type)
end
get_soa_record(name,**kwargs) click to toggle source

Queries the first ‘SOA` DNS record belonging to the host name.

@param [String] name

The host name to query.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [Resolv::DNS::Resource::SOA, nil]

The first `SOA` DNS record for the host name or `nil` if the host
name has no `SOA` records.

@see rubydoc.info/stdlib/resolv/Resolv/DNS/Resource/SOA

# File lib/ronin/support/network/dns.rb, line 1009
def self.get_soa_record(name,**kwargs)
  resolver(**kwargs).get_soa_record(name.to_s)
end
get_srv_records(name,**kwargs) click to toggle source

Queries all ‘SRV` DNS records belonging to the host name.

@param [String] name

The host name to query.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [Array<Resolv::DNS::Resource::IN::SRV>]

All `SRV` DNS records belonging to the host name.

@see rubydoc.info/stdlib/resolv/Resolv/DNS/Resource/IN/SRV

# File lib/ronin/support/network/dns.rb, line 724
def self.get_srv_records(name,**kwargs)
  resolver(**kwargs).get_srv_records(name.to_s)
end
get_txt_record(name,**kwargs) click to toggle source

Queiries the first ‘TXT` DNS record belonging to the host name.

@param [String] name

The host name to query.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [Resolv::DNS::Resource::TXT, nil]

The first `TXT` DNS record for the host name or `nil` if the host
name has no `TXT` records.

@see rubydoc.info/stdlib/resolv/Resolv/DNS/Resource/TXT

# File lib/ronin/support/network/dns.rb, line 1034
def self.get_txt_record(name,**kwargs)
  resolver(**kwargs).get_txt_record(name.to_s)
end
get_txt_records(name,**kwargs) click to toggle source

Queries all ‘TXT` DNS records belonging to the host name.

@param [String] name

The host name to query.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [Array<Resolv::DNS::Resource::TXT>]

All of the `TXT` DNS records belonging to the host name.

@see rubydoc.info/stdlib/resolv/Resolv/DNS/Resource/TXT

# File lib/ronin/support/network/dns.rb, line 1081
def self.get_txt_records(name,**kwargs)
  resolver(**kwargs).get_txt_records(name.to_s)
end
get_txt_string(name,**kwargs) click to toggle source

Queries the first ‘TXT` string belonging to the host name.

@param [String] name

The host name to query.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [String, nil]

The first `TXT` string belonging to the host name or `nil` if the
host name has no `TXT` records.
# File lib/ronin/support/network/dns.rb, line 1057
def self.get_txt_string(name,**kwargs)
  resolver(**kwargs).get_txt_string(name.to_s)
end
get_txt_strings(name,**kwargs) click to toggle source

Queries all of the ‘TXT` string values of the host name.

@param [String] name

The host name to query.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [Array<String>]

All `TXT` string values belonging of the host name.
# File lib/ronin/support/network/dns.rb, line 1103
def self.get_txt_strings(name,**kwargs)
  resolver(**kwargs).get_txt_strings(name.to_s)
end
get_wks_records(name,**kwargs) click to toggle source

Queries all ‘WKS` (Well-Known-Service) DNS records belonging to the host name.

@param [String] name

The host name to query.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments.

@option [Array<String>, String, nil] :nameservers

Optional DNS nameserver(s) to query.

@option [String, nil] :nameserver

Optional DNS nameserver to query.

@return [Array<Resolv::DNS::Resource::IN::WKS>]

All `WKS` DNS records belonging to the host name.

@see rubydoc.info/stdlib/resolv/Resolv/DNS/Resource/IN/WKS

# File lib/ronin/support/network/dns.rb, line 749
def self.get_wks_records(name,**kwargs)
  resolver(**kwargs).get_wks_records(name.to_s)
end
lookup(host,**kwargs) click to toggle source

Alias for {get_address}.

@param [String] host

The hostname to lookup.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments for {get_address}.

@return [String, nil]

The address of the hostname.

@see get_address

# File lib/ronin/support/network/dns.rb, line 137
def self.lookup(host,**kwargs)
  get_address(host,**kwargs)
end
nameserver=(new_nameserver) click to toggle source

Sets the primary DNS nameserver to be queried.

@param [String] new_nameserver

The new primary nameserver address.

@return [String]

The address of the primary nameserver.
# File lib/ronin/support/network/dns.rb, line 68
def self.nameserver=(new_nameserver)
  self.nameservers = [new_nameserver]
  return new_nameserver
end
nameservers() click to toggle source

The primary DNS nameserver(s) to query.

@return [Array<String>]

The addresses of the nameservers.

@api public

# File lib/ronin/support/network/dns.rb, line 38
def self.nameservers
  @nameservers ||= Resolver.default_nameservers
end
nameservers=(new_nameservers) click to toggle source

Sets the DNS nameserver to be queried.

@param [Array<String>] new_nameservers

The addresses of the new nameservers.

@return [Array<String>]

The addresses of the new nameservers.

@api public

# File lib/ronin/support/network/dns.rb, line 53
def self.nameservers=(new_nameservers)
  @nameservers = new_nameservers.map(&:to_s)
  @resolver    = Resolver.new(nameservers: @nameservers)
  return new_nameservers
end
resolver(nameservers: nil, nameserver: nil) click to toggle source

Creates a DNS Resolver for the given nameserver(s).

@param [Array<String>, String, nil] nameservers

Optional DNS nameserver(s) to query.

@param [String, nil] nameserver

Optional DNS nameserver to query.

@return [Resolver]

The DNS Resolver.

@api public

@since 0.6.0

# File lib/ronin/support/network/dns.rb, line 89
def self.resolver(nameservers: nil, nameserver: nil)
  if nameserver
    Resolver.new(nameserver: nameserver.to_s)
  elsif nameservers
    Resolver.new(nameservers: nameservers.map(&:to_s))
  else
    @resolver ||= Resolver.new(nameservers: self.nameservers)
  end
end
reverse_lookup(ip,**kwargs) click to toggle source

Alias for {get_name}.

@param [String] ip

The IP address to lookup.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments for {get_name}.

@return [String, nil]

The hostname of the address.

@see get_name

# File lib/ronin/support/network/dns.rb, line 203
def self.reverse_lookup(ip,**kwargs)
  get_name(ip,**kwargs)
end