Class: Mihari::Emitters::TheHive

Inherits:
Base
  • Object
show all
Defined in:
lib/mihari/emitters/the_hive.rb

Instance Method Summary collapse

Methods inherited from Base

inherited, #run

Methods included from Retriable

#retry_on_error

Methods included from Configurable

#configuration_status, #configured?

Instance Method Details

#emit(title:, description:, artifacts:, tags: [], **_options) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/mihari/emitters/the_hive.rb', line 14

def emit(title:, description:, artifacts:, tags: [], **_options)
  return if artifacts.empty?

  api.alert.create(
    title: title,
    description: description,
    artifacts: artifacts.map { |artifact| { data: artifact.data, data_type: artifact.data_type, message: description } },
    tags: tags,
    type: "external",
    source: "mihari"
  )
end

#valid?true, false

Returns:

  • (true, false)


10
11
12
# File 'lib/mihari/emitters/the_hive.rb', line 10

def valid?
  api_endpont? && api_key? && ping?
end