Sha256: 547683444fff3e75a1c5755105c5f45485fe872d420ef0089337bb24438f858d

Contents?: true

Size: 1000 Bytes

Versions: 10

Compression:

Stored size: 1000 Bytes

Contents

# frozen_string_literal: true

module Mihari
  module Analyzers
    #
    # BinaryEdge analyzer
    #
    class BinaryEdge < 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: options)

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

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

      class << self
        def configuration_keys
          %w[binaryedge_api_key]
        end
      end

      private

      #
      #
      # @return [Mihari::Clients::BinaryEdge]
      #
      def client
        Clients::BinaryEdge.new(
          api_key: api_key,
          pagination_interval: pagination_interval,
          timeout: timeout
        )
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
mihari-7.1.3 lib/mihari/analyzers/binaryedge.rb
mihari-7.1.2 lib/mihari/analyzers/binaryedge.rb
mihari-7.1.1 lib/mihari/analyzers/binaryedge.rb
mihari-7.1.0 lib/mihari/analyzers/binaryedge.rb
mihari-7.0.5 lib/mihari/analyzers/binaryedge.rb
mihari-7.0.4 lib/mihari/analyzers/binaryedge.rb
mihari-7.0.3 lib/mihari/analyzers/binaryedge.rb
mihari-7.0.2 lib/mihari/analyzers/binaryedge.rb
mihari-7.0.1 lib/mihari/analyzers/binaryedge.rb
mihari-7.0.0 lib/mihari/analyzers/binaryedge.rb