lib/mihari/analyzers/pulsedive.rb in mihari-5.1.0 vs lib/mihari/analyzers/pulsedive.rb in mihari-5.1.1

- old
+ new

@@ -1,9 +1,7 @@ # frozen_string_literal: true -require "pulsedive" - module Mihari module Analyzers class Pulsedive < Base include Mixins::Refang @@ -32,12 +30,12 @@ def configuration_keys %w[pulsedive_api_key] end - def api - @api ||= ::Pulsedive::API.new(api_key) + def client + @client ||= Clients::PulseDive.new(api_key: api_key) end # # Check whether a type is valid or not # @@ -53,15 +51,15 @@ # @return [Array<Mihari::Artifact>] # def search raise InvalidInputError, "#{query}(type: #{type || "unknown"}) is not supported." unless valid_type? - indicator = api.indicator.get_by_value(query) + indicator = client.get_indicator(query) iid = indicator["iid"] - properties = api.indicator.get_properties_by_id(iid) + properties = client.get_properties(iid) (properties["dns"] || []).filter_map do |property| - if ["A", "PTR"].include?(property["name"]) + if %w[A PTR].include?(property["name"]) nil else data = property["value"] Artifact.new(data: data, source: source, metadata: property) end