Sha256: 34cb03d489ee43bd012b0740bd619901dfdcfc088db5c31d8cf266db88ef925c

Contents?: true

Size: 793 Bytes

Versions: 8

Compression:

Stored size: 793 Bytes

Contents

# frozen_string_literal: true

module Mihari
  module Analyzers
    #
    # GreyNoise analyzer
    #
    class GreyNoise < Base
      # @return [String, nil]
      attr_reader :api_key

      #
      # @param [String] query
      # @param [Hash, nil] options
      # @param [String, nil] api_key
      #
      def initialize(query, options: nil, api_key: nil)
        super(query, options:)

        @api_key = api_key || Mihari.config.greynoise_api_key
      end

      def artifacts
        client.gnql_search_with_pagination(
          query,
          pagination_limit:
        ).map(&:artifacts).flatten
      end

      private

      def client
        Clients::GreyNoise.new(
          api_key:,
          pagination_interval:,
          timeout:
        )
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mihari-8.0.0 lib/mihari/analyzers/greynoise.rb
mihari-7.6.4 lib/mihari/analyzers/greynoise.rb
mihari-7.6.3 lib/mihari/analyzers/greynoise.rb
mihari-7.6.2 lib/mihari/analyzers/greynoise.rb
mihari-7.6.1 lib/mihari/analyzers/greynoise.rb
mihari-7.6.0 lib/mihari/analyzers/greynoise.rb
mihari-7.5.0 lib/mihari/analyzers/greynoise.rb
mihari-7.4.0 lib/mihari/analyzers/greynoise.rb