lib/ukemi/services/dnsdb.rb in ukemi-0.4.0 vs lib/ukemi/services/dnsdb.rb in ukemi-0.4.1

- old
+ new

@@ -7,38 +7,38 @@ module Services class DNSDB < Service private def config_keys - %w(DNSDB_API_KEY) + %w[DNSDB_API_KEY] end def api @api ||= ::DNSDB::API.new end def lookup_by_ip(data) results = api.lookup.rdata(type: "ip", value: data, rrtype: "A") results.map do |result| - rrname = result.dig("rrname") + rrname = result["rrname"] # Remove the last dot (e.g. "example.com.") data = rrname[0..-2] Record.new( data: data, - first_seen: Time.at(result.dig("time_first")).to_date.to_s, - last_seen: Time.at(result.dig("time_last")).to_date.to_s, + first_seen: Time.at(result["time_first"]).to_date.to_s, + last_seen: Time.at(result["time_last"]).to_date.to_s, source: name ) end end def lookup_by_domain(data) results = api.lookup.rrset(owner_name: data, rrtype: "A") results.map do |result| - first_seen = Time.at(result.dig("time_first")).to_date.to_s - last_seen = Time.at(result.dig("time_last")).to_date.to_s + first_seen = Time.at(result["time_first"]).to_date.to_s + last_seen = Time.at(result["time_last"]).to_date.to_s - values = result.dig("rdata") || [] + values = result["rdata"] || [] values.map do |value| Record.new( data: value, first_seen: first_seen, last_seen: last_seen,