class Ukemi::Services::PassiveTotal

Private Instance Methods

api() click to toggle source
# File lib/ukemi/services/passivetotal.rb, line 10
def api
  @api ||= ::PassiveTotal::API.new
end
config_keys() click to toggle source
# File lib/ukemi/services/passivetotal.rb, line 14
def config_keys
  %w[PASSIVETOTAL_USERNAME PASSIVETOTAL_API_KEY]
end
convert_to_records(results) click to toggle source
# File lib/ukemi/services/passivetotal.rb, line 28
def convert_to_records(results)
  results.map do |result|
    data = result["resolve"]
    first_seen = result["firstSeen"].to_s.split.first
    last_seen = result["lastSeen"].to_s.split.first
    Record.new(
      data: data,
      first_seen: first_seen,
      last_seen: last_seen,
      source: name
    )
  end
end
lookup_by_domain(_data) click to toggle source
# File lib/ukemi/services/passivetotal.rb, line 24
def lookup_by_domain(_data)
  []
end
lookup_by_ip(data) click to toggle source
# File lib/ukemi/services/passivetotal.rb, line 18
def lookup_by_ip(data)
  res = api.dns.passive(data)
  results = res["results"] || []
  convert_to_records results
end