mihari 4.1.1 → 4.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +26 -4
  3. data/README.md +1 -1
  4. data/lib/mihari/analyzers/base.rb +18 -10
  5. data/lib/mihari/analyzers/rule.rb +50 -7
  6. data/lib/mihari/cli/base.rb +0 -4
  7. data/lib/mihari/commands/init.rb +1 -1
  8. data/lib/mihari/commands/search.rb +11 -58
  9. data/lib/mihari/commands/validator.rb +1 -2
  10. data/lib/mihari/constants.rb +2 -0
  11. data/lib/mihari/emitters/base.rb +8 -2
  12. data/lib/mihari/emitters/http.rb +127 -0
  13. data/lib/mihari/emitters/slack.rb +40 -4
  14. data/lib/mihari/emitters/webhook.rb +7 -16
  15. data/lib/mihari/enrichers/base.rb +5 -2
  16. data/lib/mihari/enrichers/ipinfo.rb +4 -3
  17. data/lib/mihari/{web/entities → entities}/alert.rb +0 -0
  18. data/lib/mihari/{web/entities → entities}/artifact.rb +0 -0
  19. data/lib/mihari/{web/entities → entities}/autonomous_system.rb +0 -0
  20. data/lib/mihari/{web/entities → entities}/command.rb +0 -0
  21. data/lib/mihari/{web/entities → entities}/config.rb +0 -0
  22. data/lib/mihari/{web/entities → entities}/dns.rb +0 -0
  23. data/lib/mihari/{web/entities → entities}/geolocation.rb +0 -0
  24. data/lib/mihari/{web/entities → entities}/ip_address.rb +0 -0
  25. data/lib/mihari/{web/entities → entities}/message.rb +0 -0
  26. data/lib/mihari/{web/entities → entities}/reverse_dns.rb +0 -0
  27. data/lib/mihari/{web/entities → entities}/rule.rb +5 -0
  28. data/lib/mihari/{web/entities → entities}/source.rb +0 -0
  29. data/lib/mihari/{web/entities → entities}/tag.rb +0 -0
  30. data/lib/mihari/{web/entities → entities}/whois.rb +0 -0
  31. data/lib/mihari/errors.rb +2 -0
  32. data/lib/mihari/feed/reader.rb +16 -58
  33. data/lib/mihari/http.rb +99 -0
  34. data/lib/mihari/mixins/error_notification.rb +20 -0
  35. data/lib/mihari/mixins/retriable.rb +12 -2
  36. data/lib/mihari/mixins/rule.rb +1 -2
  37. data/lib/mihari/schemas/rule.rb +30 -4
  38. data/lib/mihari/structs/ipinfo.rb +2 -3
  39. data/lib/mihari/structs/rule.rb +31 -0
  40. data/lib/mihari/structs/shodan.rb +9 -1
  41. data/lib/mihari/types.rb +11 -3
  42. data/lib/mihari/version.rb +1 -1
  43. data/lib/mihari/web/api.rb +0 -20
  44. data/lib/mihari/web/app.rb +2 -2
  45. data/lib/mihari/web/endpoints/rules.rb +3 -1
  46. data/lib/mihari/web/middleware/error_notification_adapter.rb +19 -0
  47. data/lib/mihari/web/public/index.html +1 -1
  48. data/lib/mihari/web/public/redoc-static.html +1888 -166
  49. data/lib/mihari/web/public/static/css/app.0de4b715.css +1 -0
  50. data/lib/mihari/web/public/static/css/app.43138058.css +1 -0
  51. data/lib/mihari/web/public/static/css/chunk-vendors.3ed9b08e.css +7 -0
  52. data/lib/mihari/web/public/static/css/chunk-vendors.c57bb3fd.css +7 -0
  53. data/lib/mihari/web/public/static/fonts/fa-brands-400.1fd0b4d7.ttf +0 -0
  54. data/lib/mihari/web/public/static/fonts/fa-brands-400.5d5236fb.woff2 +0 -0
  55. data/lib/mihari/web/public/static/fonts/fa-brands-400.edf40f86.woff2 +0 -0
  56. data/lib/mihari/web/public/static/fonts/fa-brands-400.f7223235.ttf +0 -0
  57. data/lib/mihari/web/public/static/fonts/fa-regular-400.3665ebc7.woff2 +0 -0
  58. data/lib/mihari/web/public/static/fonts/fa-regular-400.64b3730e.woff2 +0 -0
  59. data/lib/mihari/web/public/static/fonts/fa-regular-400.95a8a8af.ttf +0 -0
  60. data/lib/mihari/web/public/static/fonts/fa-regular-400.a7fde52b.ttf +0 -0
  61. data/lib/mihari/web/public/static/fonts/fa-solid-900.0d2abd43.woff2 +0 -0
  62. data/lib/mihari/web/public/static/fonts/fa-solid-900.5b03221c.ttf +0 -0
  63. data/lib/mihari/web/public/static/fonts/fa-solid-900.6115ad71.woff2 +0 -0
  64. data/lib/mihari/web/public/static/fonts/fa-solid-900.f0203cfc.ttf +0 -0
  65. data/lib/mihari/web/public/static/fonts/fa-v4compatibility.42932bea.ttf +0 -0
  66. data/lib/mihari/web/public/static/fonts/fa-v4compatibility.e1023515.ttf +0 -0
  67. data/lib/mihari/web/public/static/js/app-legacy.46b666f0.js +2 -0
  68. data/lib/mihari/web/public/static/js/app-legacy.46b666f0.js.map +1 -0
  69. data/lib/mihari/web/public/static/js/app-legacy.e451304b.js +2 -0
  70. data/lib/mihari/web/public/static/js/app-legacy.e451304b.js.map +1 -0
  71. data/lib/mihari/web/public/static/js/app.4818aedd.js +2 -0
  72. data/lib/mihari/web/public/static/js/app.4818aedd.js.map +1 -0
  73. data/lib/mihari/web/public/static/js/app.e74e91d7.js +2 -0
  74. data/lib/mihari/web/public/static/js/app.e74e91d7.js.map +1 -0
  75. data/lib/mihari/web/public/static/js/chunk-vendors-legacy.41357cdf.js +25 -0
  76. data/lib/mihari/web/public/static/js/chunk-vendors-legacy.41357cdf.js.map +1 -0
  77. data/lib/mihari/web/public/static/js/chunk-vendors-legacy.c99e452e.js +17 -0
  78. data/lib/mihari/web/public/static/js/chunk-vendors-legacy.c99e452e.js.map +1 -0
  79. data/lib/mihari/web/public/static/js/chunk-vendors.15e84e22.js +23 -0
  80. data/lib/mihari/web/public/static/js/chunk-vendors.15e84e22.js.map +1 -0
  81. data/lib/mihari/web/public/static/js/chunk-vendors.c5525f1e.js +31 -0
  82. data/lib/mihari/web/public/static/js/chunk-vendors.c5525f1e.js.map +1 -0
  83. data/lib/mihari.rb +71 -21
  84. data/mihari.gemspec +16 -11
  85. data/sig/lib/mihari/constants.rbs +2 -0
  86. data/sig/lib/mihari/emitters/http.rbs +35 -0
  87. data/sig/lib/mihari/emitters/slack.rbs +29 -1
  88. data/sig/lib/mihari/feed/reader.rbs +2 -2
  89. data/sig/lib/mihari/http.rbs +64 -0
  90. data/sig/lib/mihari/mixins/error_notification.rbs +12 -0
  91. data/sig/lib/mihari/structs/rule.rbs +4 -0
  92. data/sig/lib/mihari/types.rbs +2 -0
  93. data/sig/lib/mihari.rbs +4 -8
  94. metadata +137 -62
  95. data/lib/mihari/cli/mixins/utils.rb +0 -72
  96. data/lib/mihari/emitters/stdout.rb +0 -22
  97. data/lib/mihari/notifiers/base.rb +0 -24
  98. data/lib/mihari/notifiers/exception_notifier.rb +0 -126
  99. data/lib/mihari/notifiers/slack.rb +0 -63
  100. data/sig/lib/mihari/cli/mixins/utils.rbs +0 -50
  101. data/sig/lib/mihari/notifiers/base.rbs +0 -18
  102. data/sig/lib/mihari/notifiers/exception_notifier.rbs +0 -75
  103. data/sig/lib/mihari/notifiers/slack.rbs +0 -50
data/lib/mihari.rb CHANGED
@@ -1,10 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # standard libs
4
+ require "ipaddr"
5
+ require "json"
6
+ require "net/http"
7
+ require "net/https"
8
+ require "resolv"
9
+ require "yaml"
10
+
11
+ # Active Support & Active Record
3
12
  require "active_support"
4
13
 
5
14
  require "active_support/core_ext/hash"
6
15
  require "active_support/core_ext/integer/time"
7
16
  require "active_support/core_ext/numeric/time"
17
+ require "active_support/core_ext/object/deep_dup"
8
18
 
9
19
  require "active_record"
10
20
 
@@ -17,23 +27,22 @@ require "dry/struct"
17
27
  require "dry/types"
18
28
  require "dry/validation"
19
29
 
20
- # standard & utility libs
30
+ # Grape
31
+ require "grape"
32
+ require "grape-entity"
33
+
34
+ # Other utility libs
21
35
  require "addressable/uri"
22
36
  require "awrence"
23
- require "colorize"
24
37
  require "email_address"
25
- require "ipaddr"
26
- require "json"
27
38
  require "memist"
28
- require "net/http"
29
- require "net/https"
30
39
  require "net/ping"
40
+ require "parallel"
31
41
  require "plissken"
32
42
  require "public_suffix"
33
- require "resolv"
43
+ require "semantic_logger"
44
+ require "sentry-ruby"
34
45
  require "uuidtools"
35
- require "yaml"
36
- require "parallel"
37
46
 
38
47
  # Load .env
39
48
  require "dotenv/load"
@@ -47,6 +56,7 @@ require "mihari/mixins/autonomous_system"
47
56
  require "mihari/mixins/configurable"
48
57
  require "mihari/mixins/database"
49
58
  require "mihari/mixins/disallowed_data_value"
59
+ require "mihari/mixins/error_notification"
50
60
  require "mihari/mixins/refang"
51
61
  require "mihari/mixins/retriable"
52
62
  require "mihari/mixins/rule"
@@ -88,6 +98,7 @@ module Mihari
88
98
  setting :webhook_url, default: ENV["WEBHOOK_URL"]
89
99
  setting :webhook_use_json_body, constructor: ->(value = ENV["WEBHOOK_USE_JSON_BODY"]) { truthy?(value) }
90
100
  setting :zoomeye_api_key, default: ENV["ZOOMEYE_API_KEY"]
101
+ setting :sentry_dsn, default: ENV["SENTRY_DSN"]
91
102
 
92
103
  class << self
93
104
  include Memist::Memoizable
@@ -106,12 +117,32 @@ module Mihari
106
117
  []
107
118
  end
108
119
  memoize :enrichers
120
+
121
+ def logger
122
+ SemanticLogger.default_level = :info
123
+ SemanticLogger.add_appender(io: $stderr, formatter: :color)
124
+ SemanticLogger["Mihari"]
125
+ end
126
+ memoize :logger
127
+
128
+ def initialize_sentry
129
+ return if Mihari.config.sentry_dsn.nil?
130
+ return if Sentry.initialized?
131
+
132
+ Sentry.init do |config|
133
+ config.dsn = Mihari.config.sentry_dsn
134
+
135
+ config.traces_sample_rate = 0.5
136
+ end
137
+ end
109
138
  end
110
139
  end
111
140
 
112
141
  require "mihari/database"
113
142
  require "mihari/type_checker"
114
143
 
144
+ require "mihari/http"
145
+
115
146
  # Constants
116
147
  require "mihari/constants"
117
148
 
@@ -151,6 +182,16 @@ require "mihari/models/tag"
151
182
  require "mihari/models/tagging"
152
183
  require "mihari/models/whois"
153
184
 
185
+ # Emitters
186
+ require "mihari/emitters/base"
187
+
188
+ require "mihari/emitters/database"
189
+ require "mihari/emitters/http"
190
+ require "mihari/emitters/misp"
191
+ require "mihari/emitters/slack"
192
+ require "mihari/emitters/the_hive"
193
+ require "mihari/emitters/webhook"
194
+
154
195
  # Analyzers
155
196
  require "mihari/analyzers/base"
156
197
 
@@ -175,19 +216,25 @@ require "mihari/analyzers/virustotal"
175
216
  require "mihari/analyzers/zoomeye"
176
217
  require "mihari/analyzers/rule"
177
218
 
178
- # Notifiers
179
- require "mihari/notifiers/base"
180
- require "mihari/notifiers/slack"
181
- require "mihari/notifiers/exception_notifier"
219
+ # Entities
220
+ require "mihari/entities/message"
182
221
 
183
- # Emitters
184
- require "mihari/emitters/base"
185
- require "mihari/emitters/database"
186
- require "mihari/emitters/misp"
187
- require "mihari/emitters/slack"
188
- require "mihari/emitters/stdout"
189
- require "mihari/emitters/the_hive"
190
- require "mihari/emitters/webhook"
222
+ require "mihari/entities/autonomous_system"
223
+ require "mihari/entities/command"
224
+ require "mihari/entities/config"
225
+ require "mihari/entities/dns"
226
+ require "mihari/entities/geolocation"
227
+ require "mihari/entities/ip_address"
228
+ require "mihari/entities/reverse_dns"
229
+ require "mihari/entities/source"
230
+ require "mihari/entities/tag"
231
+ require "mihari/entities/whois"
232
+
233
+ require "mihari/entities/artifact"
234
+
235
+ require "mihari/entities/alert"
236
+
237
+ require "mihari/entities/rule"
191
238
 
192
239
  # Status checker
193
240
  require "mihari/status"
@@ -197,3 +244,6 @@ require "mihari/web/app"
197
244
 
198
245
  # CLIs
199
246
  require "mihari/cli/main"
247
+
248
+ # initialize Sentry
249
+ Mihari.initialize_sentry
data/mihari.gemspec CHANGED
@@ -16,6 +16,8 @@ Gem::Specification.new do |spec|
16
16
 
17
17
  spec.required_ruby_version = ">= 2.7"
18
18
 
19
+ spec.metadata["rubygems_mfa_required"] = "true"
20
+
19
21
  # Specify which files should be added to the gem when it is released.
20
22
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21
23
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
@@ -26,7 +28,7 @@ Gem::Specification.new do |spec|
26
28
  spec.require_paths = ["lib"]
27
29
 
28
30
  spec.add_development_dependency "bundler", "~> 2.3"
29
- spec.add_development_dependency "coveralls_reborn", "~> 0.23"
31
+ spec.add_development_dependency "coveralls_reborn", "~> 0.24"
30
32
  spec.add_development_dependency "fakefs", "~> 1.4"
31
33
  spec.add_development_dependency "mysql2", "~> 0.5"
32
34
  spec.add_development_dependency "overcommit", "~> 0.58"
@@ -35,19 +37,19 @@ Gem::Specification.new do |spec|
35
37
  spec.add_development_dependency "rake", "~> 13.0"
36
38
  spec.add_development_dependency "rb-fsevent", "~> 0.11"
37
39
  spec.add_development_dependency "rerun", "~> 0.13"
38
- spec.add_development_dependency "rspec", "~> 3.10"
39
- spec.add_development_dependency "standard", "~> 1.7"
40
- spec.add_development_dependency "steep", "~> 0.47"
40
+ spec.add_development_dependency "rspec", "~> 3.11"
41
+ spec.add_development_dependency "simplecov-lcov", "~> 0.8.0"
42
+ spec.add_development_dependency "standard", "~> 1.8"
43
+ spec.add_development_dependency "steep", "~> 0.49"
41
44
  spec.add_development_dependency "timecop", "~> 0.9"
42
- spec.add_development_dependency "vcr", "~> 6.0"
45
+ spec.add_development_dependency "vcr", "~> 6.1"
43
46
  spec.add_development_dependency "webmock", "~> 3.14"
44
47
 
45
- spec.add_dependency "activerecord", "7.0.1"
48
+ spec.add_dependency "activerecord", "7.0.2.3"
46
49
  spec.add_dependency "addressable", "~> 2.8"
47
50
  spec.add_dependency "awrence", "~> 2.0"
48
51
  spec.add_dependency "binaryedge", "~> 0.1"
49
52
  spec.add_dependency "censysx", "~> 0.1"
50
- spec.add_dependency "colorize", "~> 0.8"
51
53
  spec.add_dependency "crtsh-rb", "~> 0.3"
52
54
  spec.add_dependency "dnpedia", "~> 0.1"
53
55
  spec.add_dependency "dnstwister", "~> 0.1"
@@ -56,8 +58,9 @@ Gem::Specification.new do |spec|
56
58
  spec.add_dependency "dry-container", "0.9.0"
57
59
  spec.add_dependency "dry-files", "0.1.0"
58
60
  spec.add_dependency "dry-initializer", "3.1.1"
61
+ spec.add_dependency "dry-schema", "1.9.1"
59
62
  spec.add_dependency "dry-struct", "1.4.0"
60
- spec.add_dependency "dry-validation", "1.7.0"
63
+ spec.add_dependency "dry-validation", "1.8.0"
61
64
  spec.add_dependency "email_address", "~> 0.2"
62
65
  spec.add_dependency "grape", "1.6.2"
63
66
  spec.add_dependency "grape-entity", "0.10.1"
@@ -65,7 +68,7 @@ Gem::Specification.new do |spec|
65
68
  spec.add_dependency "grape-swagger-entity", "0.5.1"
66
69
  spec.add_dependency "greynoise", "~> 0.1"
67
70
  spec.add_dependency "hachi", "~> 1.0"
68
- spec.add_dependency "http", "~> 5.0"
71
+ spec.add_dependency "insensitive_hash", "~> 0.3"
69
72
  spec.add_dependency "jr-cli", "~> 0.5"
70
73
  spec.add_dependency "launchy", "~> 2.5"
71
74
  spec.add_dependency "memist", "~> 2.0"
@@ -80,17 +83,19 @@ Gem::Specification.new do |spec|
80
83
  spec.add_dependency "plissken", "~> 2.0"
81
84
  spec.add_dependency "public_suffix", "~> 4.0"
82
85
  spec.add_dependency "pulsedive", "~> 0.1"
83
- spec.add_dependency "puma", "5.6.1"
86
+ spec.add_dependency "puma", "5.6.2"
84
87
  spec.add_dependency "rack", "2.2.3"
85
88
  spec.add_dependency "rack-contrib", "2.3.0"
86
89
  spec.add_dependency "rack-cors", "~> 1.1"
87
90
  spec.add_dependency "safe_shell", "~> 1.1"
88
91
  spec.add_dependency "securitytrails", "~> 1.0"
92
+ spec.add_dependency "semantic_logger", "~> 4.10"
93
+ spec.add_dependency "sentry-ruby", "~> 5.1.1"
89
94
  spec.add_dependency "shodanx", "~> 0.2"
90
95
  spec.add_dependency "slack-notifier", "~> 2.4"
91
96
  spec.add_dependency "spysex", "~> 0.2"
92
97
  spec.add_dependency "sqlite3", "~> 1.4"
93
- spec.add_dependency "thor", "1.1.0"
98
+ spec.add_dependency "thor", "1.2.1"
94
99
  spec.add_dependency "thread_safe", "~> 0.3"
95
100
  spec.add_dependency "urlscan", "~> 0.8"
96
101
  spec.add_dependency "uuidtools", "~> 2.2"
@@ -1,3 +1,5 @@
1
1
  module Mihari
2
2
  ALLOWED_DATA_TYPES: Array[String]
3
+
4
+ DEFAULT_EMITTERS: Array[Hash]
3
5
  end
@@ -0,0 +1,35 @@
1
+ module Mihari
2
+ module Emitters
3
+ class PayloadTemplate < ERB
4
+ def self.template: () -> ::String
5
+
6
+ def initialize: (title: untyped title, description: untyped description, artifacts: untyped artifacts, source: untyped source, tags: untyped tags, ?options: ::Hash[untyped, untyped] options) -> void
7
+
8
+ def result: () -> untyped
9
+ end
10
+
11
+ class HTTP < Base
12
+ # @return [Addressable::URI, nil]
13
+ attr_reader uri: Addressable::URI?
14
+
15
+ # @return [Hash]
16
+ attr_reader http_request_headers: Hash
17
+
18
+ # @return [String]
19
+ attr_reader http_request_method: String
20
+
21
+ # @return [String, nil]
22
+ attr_reader template: String?
23
+
24
+ def initialize: (*untyped args, **untyped kwargs) -> void
25
+
26
+ def emit: (title: String title, artifacts: Array[Mihari::Artifact] artifacts, ?tags: Array[String] tags, **untyped _options) -> void
27
+
28
+ def valid?: () -> bool
29
+
30
+ private
31
+
32
+ def payload_as_string: (title: String title, description: String description, artifacts: Array[Mihari::Artifact] artifacts, source: String source, tags: Array[String] tags) -> String
33
+ end
34
+ end
35
+ end
@@ -39,7 +39,35 @@ module Mihari
39
39
  end
40
40
 
41
41
  class Slack < Base
42
- def notifier: () -> Mihari::Notifiers::Slack
42
+ SLACK_WEBHOOK_URL_KEY: ::String
43
+
44
+ SLACK_CHANNEL_KEY: ::String
45
+
46
+ DEFAULT_USERNAME: ::String
47
+
48
+ #
49
+ # Slack channel to post
50
+ #
51
+ # @return [String]
52
+ #
53
+ def slack_channel: () -> String
54
+
55
+ #
56
+ # Slack webhook URL
57
+ #
58
+ # @return [String]
59
+ #
60
+ def slack_webhook_url: () -> String
61
+
62
+ #
63
+ # Check Slack webhook URL is set
64
+ #
65
+ # @return [Boolean]
66
+ #
67
+ def slack_webhook_url?: () -> bool
68
+
69
+
70
+ def notifier: () -> ::Slack::Notifier
43
71
 
44
72
  def valid?: () -> bool
45
73
 
@@ -12,8 +12,8 @@ module Mihari
12
12
 
13
13
  def initialize: (
14
14
  String uri,
15
- ?http_request_headers: Hash[(String | Symbol), untyped]] http_request_headers,
16
- ?http_request_method: ::String http_request_method,
15
+ ?http_request_headers: Hash[(String | Symbol), untyped] http_request_headers,
16
+ ?http_request_method: String http_request_method,
17
17
  ?http_request_payload_type: String? http_request_payload_type,
18
18
  ?http_request_payload: Hash[(String | Symbol), untyped] http_request_payload
19
19
  ) -> void
@@ -0,0 +1,64 @@
1
+
2
+ module Mihari
3
+ class HTTP
4
+ attr_reader uri: URI
5
+
6
+ attr_reader headers: Hash[(String | Symbol), untyped]
7
+
8
+ attr_reader payload: Hash[(String | Symbol), untyped]
9
+
10
+ def initialize: (
11
+ String uri,
12
+ ?headers: Hash[(String | Symbol), untyped] headers,
13
+ ?payload: Hash[(String | Symbol), untyped] payload
14
+ ) -> void
15
+
16
+ #
17
+ # Make a GET request
18
+ #
19
+ # @return [Net::HTTPResponse]
20
+ #
21
+ def get: () -> Net::HTTPResponse
22
+
23
+ #
24
+ # Make a POST request
25
+ #
26
+ # @return [Net::HTTPResponse]
27
+ #
28
+ def post: () -> Net::HTTPResponse
29
+
30
+ def self.get: (
31
+ String uri,
32
+ ?headers: Hash[(String | Symbol), untyped] headers,
33
+ ?payload_type: String? payload_type,
34
+ ?payload: Hash[(String | Symbol), untyped] payload
35
+ ) -> Net::HTTPResponse
36
+
37
+ def self.post: (
38
+ String uri,
39
+ ?headers: Hash[(String | Symbol), untyped] headers,
40
+ ?payload_type: String? payload_type,
41
+ ?payload: Hash[(String | Symbol), untyped] payload
42
+ ) -> Net::HTTPResponse
43
+
44
+ private
45
+
46
+ def content_type: () -> String
47
+
48
+ #
49
+ # Get options for HTTP request
50
+ #
51
+ # @return [Hahs]
52
+ #
53
+ def https_options: () -> ({ use_ssl: ::TrueClass } | ::Hash[untyped, untyped])
54
+
55
+ #
56
+ # Make a HTTP request
57
+ #
58
+ # @param [Net::HTTPRequest] req
59
+ #
60
+ # @return [Net::HTTPResponse]
61
+ #
62
+ def request: (untyped req) -> Net::HTTPResponse
63
+ end
64
+ end
@@ -0,0 +1,12 @@
1
+ module Mihari
2
+ module Mixins
3
+ module ErrorNotification
4
+ #
5
+ # Send an exception notification if there is any error in a block
6
+ #
7
+ # @return [Nil]
8
+ #
9
+ def with_error_notification: () { () -> untyped } -> void
10
+ end
11
+ end
12
+ end
@@ -50,6 +50,10 @@ module Mihari
50
50
  # @return [Mihari::Rule]
51
51
  #
52
52
  def to_model: () -> Mihari::Rule
53
+
54
+ def to_analyzer: () -> Mihari::Analyzers::Rule
55
+
56
+ def self.from_model: (Mihari::Rule model) -> Mihari::Structs::Rule::Rule
53
57
  end
54
58
  end
55
59
  end
@@ -17,5 +17,7 @@ module Mihari
17
17
  FeedHttpRequestMethods: Array[String]
18
18
 
19
19
  FeedHttpRequestPayloadTypes: Array[String]
20
+
21
+ EmitterTypes: Array[String]
20
22
  end
21
23
  end
data/sig/lib/mihari.rbs CHANGED
@@ -25,6 +25,7 @@ class Configuration
25
25
  attr_accessor webhook_url (): String?
26
26
  attr_accessor webhook_use_json_body (): (bool | nil)
27
27
  attr_accessor database (): String?
28
+ attr_accessor sentry_dsn(): String?
28
29
 
29
30
  attr_reader values: Hash[(String | Symbol), String?]
30
31
  end
@@ -42,14 +43,9 @@ module Mihari
42
43
 
43
44
  def self.enrichers: () -> ::Array[singleton(Mihari::Enrichers::Base)]
44
45
 
45
- #
46
- # Load configuration from YAML file
47
- #
48
- # @param [String] path Path to YAML file
49
- #
50
- # @return [nil]
51
- #
52
- def self.load_config_from_yaml: (String path) -> void
46
+ def self.logger: () -> SemanticLogger
47
+
48
+ def self.initialize_sentry: () -> void
53
49
  end
54
50
 
55
51
  class Object