Sha256: 113f08fdfd0fcae15e160b99595cc581a209ae8c3be529a2f7183d3d46c246c0
Contents?: true
Size: 924 Bytes
Versions: 1
Compression:
Stored size: 924 Bytes
Contents
# frozen_string_literal: true require "passive_circl" module Ukemi module Services class CIRCL < Service private def config_keys %w[CIRCL_PASSIVE_USERNAME CIRCL_PASSIVE_PASSWORD] end def api @api ||= PassiveCIRCL::API.new end def lookup_by_domain(data) passive_dns_lookup(data, "rdata") end def lookup_by_ip(data) passive_dns_lookup(data, "rrname") end def passive_dns_lookup(data, key = nil) results = api.dns.query(data) results = results.select do |result| result["rrtype"] == "A" end results.map do |result| Record.new( data: result[key], 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 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ukemi-0.4.1 | lib/ukemi/services/circl.rb |