mihari 7.6.4 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 12856ce5fee6e623a5579cab99a03629c611db1f65e087b04167cae69f870647
4
- data.tar.gz: 28577ad798c7033ead6aaeced545a9401f17d0a31d29551950c3be583bc107ea
3
+ metadata.gz: 75cc81f17196e45d76732a65800c54416d73c2b86751ee3745f7d02d9e938b59
4
+ data.tar.gz: 0300cb460d5cecae999c095967dbb6c2827fe59b0404becdb287f9df07a6ef8d
5
5
  SHA512:
6
- metadata.gz: 68d780eca473d2b081c3c9bb7a60c9c5bfa371a0c6e08a307ceaa3138f5097b70606902e657aab22d1013a5033904bd7135595812d76a0554bde38f3b75917b6
7
- data.tar.gz: 6b0ab8b458109b4c496298560772bd44e845a96c97ab89ec3191416855a66c4de92277d66d63607b17a857d35be10343adbdd71183616f64e7b984b617cde32a
6
+ metadata.gz: aa653f50889b81341aa06a2d4bbab8c5bfb83bfb2adc60bbbba88933b24fe61503e52de6f5f8b082f5af7f697b249d206e545257def2603a6d0ab76fed090047
7
+ data.tar.gz: 1737d85fb2322b49cc5b0a47ea3ad8a3cb723cfa8e7c793f57dd8747472e4509c8282c81148e454ef81f70fa55d6bc037d596ffe538f40fab98b8a1661feda25
@@ -22,7 +22,7 @@ module Mihari
22
22
  #
23
23
  def _search(q, page: 1, limit: 10)
24
24
  filter = Structs::Filters::Search.new(q:, page:, limit:)
25
- Services::AlertSearcher.result(filter).value!
25
+ Services::AlertSearcher.call filter
26
26
  end
27
27
  end
28
28
 
@@ -33,15 +33,14 @@ module Mihari
33
33
  #
34
34
  def create(path)
35
35
  # @type [Mihari::Models::Alert]
36
- alert = Dry::Monads::Try[StandardError] do
37
- raise ArgumentError, "#{path} not found" unless Pathname(path).exist?
36
+ raise ArgumentError, "#{path} not found" unless Pathname(path).exist?
37
+
38
+ params = YAML.safe_load(
39
+ ERB.new(File.read(path)).result,
40
+ permitted_classes: [Date, Symbol]
41
+ )
42
+ alert = Services::AlertCreator.call(params)
38
43
 
39
- params = YAML.safe_load(
40
- ERB.new(File.read(path)).result,
41
- permitted_classes: [Date, Symbol]
42
- )
43
- Services::AlertCreator.call params
44
- end.value!
45
44
  data = Entities::Alert.represent(alert)
46
45
  puts JSON.pretty_generate(data.as_json)
47
46
  end
@@ -103,7 +102,7 @@ module Mihari
103
102
  # @param [Integer] id
104
103
  #
105
104
  def delete(id)
106
- Services::AlertDestroyer.result(id).value!
105
+ Services::AlertDestroyer.call id
107
106
  end
108
107
  end
109
108
  end
@@ -21,7 +21,7 @@ module Mihari
21
21
  #
22
22
  def _search(q, page: 1, limit: 10)
23
23
  filter = Structs::Filters::Search.new(q:, page:, limit:)
24
- Services::ArtifactSearcher.result(filter).value!
24
+ Services::ArtifactSearcher.call filter
25
25
  end
26
26
  end
27
27
 
@@ -82,7 +82,7 @@ module Mihari
82
82
  # @param [Integer] id
83
83
  #
84
84
  def enrich(id)
85
- Services::ArtifactEnricher.result(id).value!
85
+ Services::ArtifactEnricher.call id
86
86
  end
87
87
 
88
88
  desc "delete ID", "Delete an artifact"
@@ -91,7 +91,7 @@ module Mihari
91
91
  # @param [Integer] id
92
92
  #
93
93
  def delete(id)
94
- Services::ArtifactDestroyer.result(id).value!
94
+ Services::ArtifactDestroyer.call id
95
95
  end
96
96
  end
97
97
  end
@@ -22,7 +22,7 @@ module Mihari
22
22
  #
23
23
  def _search(q, page: 1, limit: 10)
24
24
  filter = Structs::Filters::Search.new(q:, page:, limit:)
25
- Services::RuleSearcher.result(filter).value!
25
+ Services::RuleSearcher.call filter
26
26
  end
27
27
  end
28
28
 
@@ -70,7 +70,7 @@ module Mihari
70
70
  warning = "Do you want to overwrite it? (y/n)"
71
71
  return if Pathname(path).exist? && !(yes? warning)
72
72
 
73
- Services::RuleInitializer.call(path)
73
+ Services::RuleInitializer.call path
74
74
  end
75
75
 
76
76
  desc "list QUERY", "List/search rules"
@@ -127,7 +127,7 @@ module Mihari
127
127
  # @param [String] id
128
128
  #
129
129
  def delete(id)
130
- Services::RuleDestroyer.result(id).value!
130
+ Services::RuleDestroyer.call id
131
131
  end
132
132
  end
133
133
  end
@@ -24,16 +24,13 @@ module Mihari
24
24
  force_overwrite = options["force_overwrite"] || false
25
25
  message = "Are you sure you want to overwrite this rule? (y/n)"
26
26
 
27
- # @type [Mihari::Models::Alert]
28
- alert = Dry::Monads::Try[StandardError] do
29
- # @type [Mihari::Rule]
30
- rule = Services::RuleBuilder.call(path_or_id)
27
+ # @type [Mihari::Rule]
28
+ rule = Services::RuleBuilder.call(path_or_id)
29
+ exit 0 if rule.diff? && !force_overwrite && !yes?(message)
31
30
 
32
- exit 0 if rule.diff? && !force_overwrite && !yes?(message)
31
+ rule.update_or_create
32
+ alert = rule.call
33
33
 
34
- rule.update_or_create
35
- rule.call
36
- end.value!
37
34
  data = Entities::Alert.represent(alert)
38
35
  puts JSON.pretty_generate(data.as_json)
39
36
  end
@@ -21,7 +21,7 @@ module Mihari
21
21
  #
22
22
  def _search(q, page: 1, limit: 10)
23
23
  filter = Structs::Filters::Search.new(q:, page:, limit:)
24
- Services::TagSearcher.result(filter).value!
24
+ Services::TagSearcher.call filter
25
25
  end
26
26
  end
27
27
 
@@ -71,7 +71,7 @@ module Mihari
71
71
  # @param [Integer] id
72
72
  #
73
73
  def delete(id)
74
- Services::TagDestroyer.result(id).value!
74
+ Services::TagDestroyer.call id
75
75
  end
76
76
  end
77
77
  end
@@ -6,7 +6,7 @@ ActiveSupport::Inflector.inflections(:en) { |inflect| inflect.acronym "CPE" }
6
6
  #
7
7
  # Mihari v7 DB schema
8
8
  #
9
- class V7Schema < ActiveRecord::Migration[7.2]
9
+ class V7Schema < ActiveRecord::Migration[8.0]
10
10
  def change
11
11
  create_table :rules, id: :string, if_not_exists: true do |t|
12
12
  t.string :title, null: false
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mihari
4
- VERSION = "7.6.4"
4
+ VERSION = "8.0.0"
5
5
  end