Sha256: a252d2dbc81c23ed7a00cac5fad53797af7a543c931346705a9b812201ba34b1
Contents?: true
Size: 1.25 KB
Versions: 9
Compression:
Stored size: 1.25 KB
Contents
# frozen_string_literal: true require "pulsedive" module Mihari module Analyzers class Pulsedive < Base attr_reader :query attr_reader :type attr_reader :title attr_reader :description attr_reader :tags def initialize(query, title: nil, description: nil, tags: []) super() @query = query @type = TypeChecker.type(query) @title = title || "Pulsedive lookup" @description = description || "query = #{query}" @tags = tags end def artifacts lookup || [] end private def config_keys %w(pulsedive_api_key) end def api @api ||= ::Pulsedive::API.new(Mihari.config.pulsedive_api_key) end def valid_type? %w(ip domain).include? type end def lookup raise InvalidInputError, "#{query}(type: #{type || 'unknown'}) is not supported." unless valid_type? indicator = api.indicator.get_by_value(query) iid = indicator.dig("iid") properties = api.indicator.get_properties_by_id(iid) (properties.dig("dns") || []).map do |property| property.dig("value") if ["A", "PTR"].include?(property.dig("name")) end.compact end end end end
Version data entries
9 entries across 9 versions & 1 rubygems