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 +4 -4
- data/lib/mihari/commands/alert.rb +9 -10
- data/lib/mihari/commands/artifact.rb +3 -3
- data/lib/mihari/commands/rule.rb +3 -3
- data/lib/mihari/commands/search.rb +5 -8
- data/lib/mihari/commands/tag.rb +2 -2
- data/lib/mihari/database.rb +1 -1
- data/lib/mihari/version.rb +1 -1
- data/lib/mihari/web/public/assets/{index-HxkDEHGe.js → index-B1FXFQWK.js} +65 -65
- data/lib/mihari/web/public/index.html +2 -2
- data/lib/mihari/web/public/redoc-static.html +15 -15
- data/mihari.gemspec +20 -20
- data/requirements.txt +1 -1
- metadata +42 -42
- /data/lib/mihari/web/public/assets/{index-BgJUBUyh.css → index-oiGfMI5B.css} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75cc81f17196e45d76732a65800c54416d73c2b86751ee3745f7d02d9e938b59
|
4
|
+
data.tar.gz: 0300cb460d5cecae999c095967dbb6c2827fe59b0404becdb287f9df07a6ef8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|
-
|
37
|
-
|
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.
|
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.
|
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.
|
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.
|
94
|
+
Services::ArtifactDestroyer.call id
|
95
95
|
end
|
96
96
|
end
|
97
97
|
end
|
data/lib/mihari/commands/rule.rb
CHANGED
@@ -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.
|
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
|
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.
|
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::
|
28
|
-
|
29
|
-
|
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
|
-
|
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
|
data/lib/mihari/commands/tag.rb
CHANGED
@@ -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.
|
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.
|
74
|
+
Services::TagDestroyer.call id
|
75
75
|
end
|
76
76
|
end
|
77
77
|
end
|
data/lib/mihari/database.rb
CHANGED
@@ -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[
|
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
|
data/lib/mihari/version.rb
CHANGED