class Ryo::Plugin::Whois

Attributes

domain[R]

Public Class Methods

discover(domain) click to toggle source
# File lib/ryo/plugin/whois.rb, line 61
def self.discover(domain)
  new(domain).discover
end
new(domain) click to toggle source
# File lib/ryo/plugin/whois.rb, line 7
def initialize(domain)
  @domain = domain
end

Public Instance Methods

discover() click to toggle source
# File lib/ryo/plugin/whois.rb, line 57
def discover
  parse
end
doc() click to toggle source
# File lib/ryo/plugin/whois.rb, line 20
def doc
  @doc ||= Oga.parse_html(fetch_body)
end
endpoint() click to toggle source
# File lib/ryo/plugin/whois.rb, line 11
def endpoint
  "https://domainbigdata.com"
end
fetch_body() click to toggle source
# File lib/ryo/plugin/whois.rb, line 15
def fetch_body
  res = Client.http.get("#{endpoint}/#{domain}")
  res.body.to_s
end
globa_stats() click to toggle source
# File lib/ryo/plugin/whois.rb, line 31
def globa_stats
  h = {}
  h[:title] = doc.at_css("#trTitle > td:nth-child(2)")&.text
  h[:date_creation] = doc.at_css("#trDateCreation > td:nth-child(2)")&.text
  h[:date_creation] = doc.at_css("#trDateCreation > td:nth-child(2)")&.text
  h[:web_age] = doc.at_css("#trWebAge > td:nth-child(2)")&.text
  h[:ip] = doc.at_css("#trIP > td:nth-child(2)")&.text
  h[:ip_geolocation] = doc.at_css("#trIPGeolocation > td:nth-child(2)")&.text&.strip
  h.compact
end
parse() click to toggle source
# File lib/ryo/plugin/whois.rb, line 24
def parse
  h = {}
  h[:globa_stats] = globa_stats
  h[:registrant] = registrant
  h
end
registrant() click to toggle source
# File lib/ryo/plugin/whois.rb, line 42
def registrant
  h = {}
  h[:name] = doc.at_css("#trRegistrantName > td:nth-child(2) > a")&.text
  h[:organization] = doc.at_css("#MainMaster_trRegistrantOrganization > td:nth-child(2) > a")&.text
  h[:email] = doc.at_css("#trRegistrantEmail > td:nth-child(2)")&.text
  h[:address] = doc.at_css("#trRegistrantAddress > td:nth-child(2)")&.text
  h[:city] = doc.at_css("#trRegistrantCity > td:nth-child(2)")&.text
  h[:state] = doc.at_css("#trRegistrantState > td:nth-child(2)")&.text
  h[:country] = doc.at_css("#trRegistrantCountry > td:nth-child(2)")&.text
  h[:phone] = doc.at_css("#trRegistrantTel > td:nth-child(2)")&.text
  h[:fax] = doc.at_css("#trRegistrantFax > td:nth-child(2)")&.text
  h[:private] = doc.at_css("#MainMaster_divRegistrantIDCard > div:nth-child(4) > table > tbody > tr:nth-child(10) > td:nth-child(2)")&.text
  h.compact
end