Sha256: b575670f78284bc7aeffa7c781cc3cd8b12aa48569326668d95b1a95711500fd

Contents?: true

Size: 492 Bytes

Versions: 2

Compression:

Stored size: 492 Bytes

Contents

# frozen_string_literal: true

require "securitytrails"

module Osakana
  module Enrichers
    class SecurityTrails < Base
      def api
        @api ||= ::SecurityTrails::API.new
      end

      def domain_to_ipv4(domain)
        res = api.history.get_dns_history(domain, "a")
        res&.records&.first&.values&.first&.ip
      end

      def ipv4_to_domain(ipv4)
        res = api.domains.search( filter: { ipv4: ipv4 })
        res&.records&.first&.hostname
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
osakana-0.4.0 lib/osakana/enrichers/securitytrails.rb
osakana-0.3.0 lib/osakana/enrichers/securitytrails.rb