lib/mihari/analyzers/base.rb in mihari-0.8.2 vs lib/mihari/analyzers/base.rb in mihari-0.9.0

- old
+ new

@@ -1,7 +1,9 @@ # frozen_string_literal: true +require "parallel" + module Mihari module Analyzers class Base def initialize @the_hive = TheHive.new @@ -27,11 +29,13 @@ def tags [] end def run - Mihari.emitters.each do |emitter_class| + set_unique_artifacts + + Parallel.each(Mihari.emitters) do |emitter_class| emitter = emitter_class.new next unless emitter.valid? run_emitter emitter end @@ -61,9 +65,15 @@ # @return [Array<Mihari::Artifact>] def unique_artifacts return uncached_artifacts unless @the_hive.valid? @unique_artifacts ||= @the_hive.artifact.find_non_existing_artifacts(uncached_artifacts) + end + + private + + def set_unique_artifacts + unique_artifacts end end end end