Sha256: 7162233a661315beceabbc421e0b72e7ccf32ea6acfdbb166f50bc209b4f697f

Contents?: true

Size: 577 Bytes

Versions: 1

Compression:

Stored size: 577 Bytes

Contents

# frozen_string_literal: true

module Mihari
  module Enrichers
    #
    # Shodan enricher
    #
    class Shodan < Base
      #
      # Query Shodan Internet DB
      #
      # @param [String] ip
      #
      # @return [Mihari::Structs::Shodan::InternetDBResponse, nil]
      #
      def call(ip)
        url = "https://internetdb.shodan.io/#{ip}"
        res = http.get(url)
        Structs::Shodan::InternetDBResponse.from_dynamic! JSON.parse(res.body.to_s)
      end

      private

      def http
        HTTP::Factory.build timeout: timeout
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mihari-6.0.0 lib/mihari/enrichers/shodan.rb