Class: Mihari::Emitters::TheHive

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

inherited

Constructor Details

#initializeTheHive

Returns a new instance of TheHive.



8
9
10
# File 'lib/mihari/emitters/the_hive.rb', line 8

def initialize
  @the_hive = Mihari::TheHive.new
end

Instance Attribute Details

#the_hiveObject (readonly)

Returns the value of attribute the_hive.



6
7
8
# File 'lib/mihari/emitters/the_hive.rb', line 6

def the_hive
  @the_hive
end

Instance Method Details

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



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

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

  the_hive.alert.create(
    title: title,
    description: description,
    artifacts: artifacts.map(&:to_h),
    tags: tags
  )
end

#valid?true, false

Returns:

  • (true, false)


13
14
15
# File 'lib/mihari/emitters/the_hive.rb', line 13

def valid?
  the_hive.valid?
end