Class: Mihari::TheHive::Alert

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

Instance Method Summary collapse

Methods inherited from Base

#api

Instance Method Details

#create(title:, description:, artifacts:, tags: []) ⇒ Hash

Returns:

  • (Hash)


13
14
15
16
17
18
19
20
21
22
# File 'lib/mihari/the_hive/alert.rb', line 13

def create(title:, description:, artifacts:, tags: [])
  api.alert.create(
    title: title,
    description: description,
    artifacts: artifacts,
    tags: tags,
    type: "external",
    source: "mihari"
  )
end

#list(range: "all", sort: "-date") ⇒ Array

Returns:

  • (Array)


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

def list(range: "all", sort: "-date")
  alerts = api.alert.search({ source: "mihari" }, range: range, sort: sort)
  alerts.sort_by { |alert| -alert.dig("createdAt") }
end