class Cymru::IPAddress
Constants
- BOGON
- ORIGIN
- ORIGIN6
Attributes
allocdate[R]
asname[R]
asnum[R]
cidr[R]
country[R]
registry[R]
Public Class Methods
new()
click to toggle source
# File lib/cymruwhois.rb, line 35 def initialize end
Public Instance Methods
whois(addr)
click to toggle source
# File lib/cymruwhois.rb, line 38 def whois(addr) ip = IPAddr.new(addr) if ip.ipv4? revdns = ip.reverse.sub("in-addr.arpa", ORIGIN) elsif ip.ipv6? revdns = ip.reverse.sub("ip6.arpa", ORIGIN6) end ansip = intxt(revdns) @asnum = ansip[0] @cidr = ansip[1] @country = ansip[2] @registry = ansip[3] @allocdate = ansip[4] # to address the multi ASN issue for the same IP Block asparam = ansip[0].split ansasnum = Cymru::ASNumber.new ansasnum.whois(asparam[0]) @asname = ansasnum.asname ansip << @asname end
Also aliased as: lookup