mihari 6.3.0 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (160) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +4 -10
  3. data/.rubocop.yml +2 -0
  4. data/Dockerfile +13 -0
  5. data/config.ru +5 -3
  6. data/docker-compose.yml +62 -0
  7. data/exe/mihari +2 -1
  8. data/lefthook.yml +8 -0
  9. data/lib/mihari/actor.rb +4 -4
  10. data/lib/mihari/analyzers/base.rb +16 -0
  11. data/lib/mihari/analyzers/binaryedge.rb +4 -2
  12. data/lib/mihari/analyzers/censys.rb +7 -5
  13. data/lib/mihari/analyzers/circl.rb +5 -3
  14. data/lib/mihari/analyzers/crtsh.rb +4 -1
  15. data/lib/mihari/analyzers/dnstwister.rb +1 -1
  16. data/lib/mihari/analyzers/feed.rb +12 -20
  17. data/lib/mihari/analyzers/fofa.rb +6 -8
  18. data/lib/mihari/analyzers/greynoise.rb +4 -2
  19. data/lib/mihari/analyzers/hunterhow.rb +4 -2
  20. data/lib/mihari/analyzers/onyphe.rb +4 -2
  21. data/lib/mihari/analyzers/otx.rb +5 -3
  22. data/lib/mihari/analyzers/passivetotal.rb +29 -12
  23. data/lib/mihari/analyzers/pulsedive.rb +5 -3
  24. data/lib/mihari/analyzers/securitytrails.rb +32 -8
  25. data/lib/mihari/analyzers/shodan.rb +4 -2
  26. data/lib/mihari/analyzers/urlscan.rb +4 -2
  27. data/lib/mihari/analyzers/virustotal.rb +5 -5
  28. data/lib/mihari/analyzers/virustotal_intelligence.rb +4 -2
  29. data/lib/mihari/analyzers/zoomeye.rb +4 -2
  30. data/lib/mihari/cli/{main.rb → application.rb} +17 -5
  31. data/lib/mihari/cli/artifact.rb +14 -0
  32. data/lib/mihari/cli/config.rb +14 -0
  33. data/lib/mihari/cli/rule.rb +1 -0
  34. data/lib/mihari/cli/tag.rb +14 -0
  35. data/lib/mihari/clients/base.rb +2 -2
  36. data/lib/mihari/clients/binaryedge.rb +2 -2
  37. data/lib/mihari/clients/crtsh.rb +2 -9
  38. data/lib/mihari/clients/fofa.rb +1 -1
  39. data/lib/mihari/clients/hunterhow.rb +1 -1
  40. data/lib/mihari/clients/mmdb.rb +28 -0
  41. data/lib/mihari/clients/passivetotal.rb +7 -20
  42. data/lib/mihari/clients/securitytrails.rb +19 -43
  43. data/lib/mihari/clients/shodan_internet_db.rb +28 -0
  44. data/lib/mihari/clients/the_hive.rb +7 -5
  45. data/lib/mihari/commands/alert.rb +53 -11
  46. data/lib/mihari/commands/artifact.rb +66 -0
  47. data/lib/mihari/commands/config.rb +23 -0
  48. data/lib/mihari/commands/database.rb +1 -1
  49. data/lib/mihari/commands/rule.rb +40 -27
  50. data/lib/mihari/commands/search.rb +10 -11
  51. data/lib/mihari/commands/sidekiq.rb +31 -0
  52. data/lib/mihari/commands/tag.rb +46 -0
  53. data/lib/mihari/commands/web.rb +6 -7
  54. data/lib/mihari/{mixins/autonomous_system.rb → concerns/autonomous_system_normalizable.rb} +5 -3
  55. data/lib/mihari/concerns/configurable.rb +72 -0
  56. data/lib/mihari/concerns/database_connectable.rb +16 -0
  57. data/lib/mihari/{mixins/unwrap_error.rb → concerns/error_unwrappable.rb} +5 -3
  58. data/lib/mihari/{mixins/falsepositive.rb → concerns/falsepositive_validatable.rb} +5 -3
  59. data/lib/mihari/{mixins/refang.rb → concerns/refangable.rb} +5 -3
  60. data/lib/mihari/{mixins → concerns}/retriable.rb +4 -2
  61. data/lib/mihari/config.rb +13 -12
  62. data/lib/mihari/database.rb +30 -42
  63. data/lib/mihari/emitters/database.rb +5 -6
  64. data/lib/mihari/emitters/misp.rb +4 -11
  65. data/lib/mihari/emitters/slack.rb +7 -5
  66. data/lib/mihari/emitters/the_hive.rb +8 -58
  67. data/lib/mihari/emitters/webhook.rb +6 -6
  68. data/lib/mihari/enrichers/google_public_dns.rb +1 -1
  69. data/lib/mihari/enrichers/mmdb.rb +28 -0
  70. data/lib/mihari/enrichers/shodan.rb +3 -5
  71. data/lib/mihari/enrichers/whois.rb +3 -3
  72. data/lib/mihari/entities/alert.rb +3 -10
  73. data/lib/mihari/entities/artifact.rb +6 -14
  74. data/lib/mihari/entities/config.rb +2 -2
  75. data/lib/mihari/entities/cpe.rb +1 -0
  76. data/lib/mihari/entities/dns.rb +1 -0
  77. data/lib/mihari/entities/geolocation.rb +1 -0
  78. data/lib/mihari/entities/ip_address.rb +1 -3
  79. data/lib/mihari/entities/messages.rb +17 -0
  80. data/lib/mihari/entities/pagination.rb +11 -0
  81. data/lib/mihari/entities/port.rb +1 -0
  82. data/lib/mihari/entities/reverse_dns.rb +1 -0
  83. data/lib/mihari/entities/rule.rb +2 -20
  84. data/lib/mihari/entities/tag.rb +2 -2
  85. data/lib/mihari/entities/whois.rb +1 -0
  86. data/lib/mihari/errors.rb +2 -4
  87. data/lib/mihari/http.rb +4 -0
  88. data/lib/mihari/models/alert.rb +21 -53
  89. data/lib/mihari/models/artifact.rb +46 -88
  90. data/lib/mihari/models/autonomous_system.rb +5 -13
  91. data/lib/mihari/models/concerns/searchable.rb +50 -0
  92. data/lib/mihari/models/cpe.rb +3 -10
  93. data/lib/mihari/models/dns.rb +2 -6
  94. data/lib/mihari/models/geolocation.rb +7 -12
  95. data/lib/mihari/models/port.rb +3 -10
  96. data/lib/mihari/models/reverse_dns.rb +3 -8
  97. data/lib/mihari/models/rule.rb +16 -57
  98. data/lib/mihari/models/tag.rb +17 -1
  99. data/lib/mihari/models/tagging.rb +1 -1
  100. data/lib/mihari/models/whois.rb +1 -4
  101. data/lib/mihari/rule.rb +35 -24
  102. data/lib/mihari/schemas/alert.rb +1 -0
  103. data/lib/mihari/schemas/analyzer.rb +2 -2
  104. data/lib/mihari/schemas/concerns/orrable.rb +24 -0
  105. data/lib/mihari/schemas/emitter.rb +1 -2
  106. data/lib/mihari/schemas/enricher.rb +3 -4
  107. data/lib/mihari/schemas/macros.rb +1 -1
  108. data/lib/mihari/schemas/options.rb +0 -2
  109. data/lib/mihari/schemas/rule.rb +1 -2
  110. data/lib/mihari/services/{rule_builder.rb → builders.rb} +1 -6
  111. data/lib/mihari/services/creators.rb +22 -0
  112. data/lib/mihari/services/destroyers.rb +41 -0
  113. data/lib/mihari/services/enrichers.rb +25 -0
  114. data/lib/mihari/services/feed.rb +107 -0
  115. data/lib/mihari/services/getters.rb +58 -0
  116. data/lib/mihari/services/initializers.rb +22 -0
  117. data/lib/mihari/services/{alert_builder.rb → proxies.rb} +10 -40
  118. data/lib/mihari/services/searchers.rb +91 -0
  119. data/lib/mihari/sidekiq/application.rb +13 -0
  120. data/lib/mihari/sidekiq/jobs.rb +36 -0
  121. data/lib/mihari/structs/censys.rb +1 -1
  122. data/lib/mihari/structs/config.rb +10 -10
  123. data/lib/mihari/structs/filters.rb +12 -130
  124. data/lib/mihari/structs/google_public_dns.rb +1 -1
  125. data/lib/mihari/structs/greynoise.rb +1 -1
  126. data/lib/mihari/structs/mmdb.rb +115 -0
  127. data/lib/mihari/structs/onyphe.rb +1 -1
  128. data/lib/mihari/structs/shodan.rb +2 -2
  129. data/lib/mihari/version.rb +1 -1
  130. data/lib/mihari/web/{app.rb → application.rb} +28 -15
  131. data/lib/mihari/web/endpoints/alerts.rb +34 -73
  132. data/lib/mihari/web/endpoints/artifacts.rb +27 -111
  133. data/lib/mihari/web/endpoints/configs.rb +3 -5
  134. data/lib/mihari/web/endpoints/ip_addresses.rb +14 -15
  135. data/lib/mihari/web/endpoints/rules.rb +58 -130
  136. data/lib/mihari/web/endpoints/tags.rb +21 -17
  137. data/lib/mihari/web/middleware/capture_exceptions.rb +25 -0
  138. data/lib/mihari/web/middleware/{connection_adapter.rb → connection.rb} +4 -2
  139. data/lib/mihari/web/public/assets/index-cQUcyII5.js +1766 -0
  140. data/lib/mihari/web/public/assets/index-dVaNxqTC.css +1 -0
  141. data/lib/mihari/web/public/index.html +2 -2
  142. data/lib/mihari/web/public/redoc-static.html +385 -385
  143. data/lib/mihari.rb +56 -28
  144. data/mihari.gemspec +12 -4
  145. data/mkdocs.yml +5 -2
  146. data/requirements.txt +1 -1
  147. metadata +164 -34
  148. data/lib/mihari/commands/mixins.rb +0 -11
  149. data/lib/mihari/enrichers/ipinfo.rb +0 -52
  150. data/lib/mihari/entities/message.rb +0 -9
  151. data/lib/mihari/feed/parser.rb +0 -38
  152. data/lib/mihari/feed/reader.rb +0 -111
  153. data/lib/mihari/mixins/configurable.rb +0 -68
  154. data/lib/mihari/schemas/mixins.rb +0 -20
  155. data/lib/mihari/services/alert_runner.rb +0 -20
  156. data/lib/mihari/structs/ipinfo.rb +0 -53
  157. data/lib/mihari/web/endpoints/exports.rb +0 -0
  158. data/lib/mihari/web/middleware/error_notification_adapter.rb +0 -35
  159. data/lib/mihari/web/public/assets/index-81613_nX.js +0 -1763
  160. data/lib/mihari/web/public/assets/index-Wv6xUrTI.css +0 -1
data/lib/mihari.rb CHANGED
@@ -1,21 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # standard libs
4
+ require "date"
5
+ require "erb"
4
6
  require "ipaddr"
5
7
  require "json"
8
+ require "pathname"
6
9
  require "resolv"
10
+ require "securerandom"
7
11
  require "yaml"
8
12
 
9
13
  # Active Support & Active Record
10
14
  require "active_support"
11
-
12
- require "active_support/core_ext/hash"
13
- require "active_support/core_ext/integer/time"
14
- require "active_support/core_ext/numeric/time"
15
- require "active_support/core_ext/object/deep_dup"
16
-
17
15
  require "active_record"
18
16
 
17
+ # Search Cop
18
+ require "search_cop"
19
+
19
20
  # dry-rb
20
21
  require "dry/files"
21
22
  require "dry/monads"
@@ -49,13 +50,14 @@ require "mihari/errors"
49
50
 
50
51
  require "mihari/config"
51
52
 
52
- # Mixins
53
- require "mihari/mixins/autonomous_system"
54
- require "mihari/mixins/configurable"
55
- require "mihari/mixins/falsepositive"
56
- require "mihari/mixins/refang"
57
- require "mihari/mixins/retriable"
58
- require "mihari/mixins/unwrap_error"
53
+ # Concerns
54
+ require "mihari/concerns/autonomous_system_normalizable"
55
+ require "mihari/concerns/configurable"
56
+ require "mihari/concerns/database_connectable"
57
+ require "mihari/concerns/error_unwrappable"
58
+ require "mihari/concerns/falsepositive_validatable"
59
+ require "mihari/concerns/refangable"
60
+ require "mihari/concerns/retriable"
59
61
 
60
62
  #
61
63
  # Mihari module
@@ -129,6 +131,27 @@ module Mihari
129
131
  end
130
132
  memo_wise :logger
131
133
 
134
+ #
135
+ # @return [String]
136
+ #
137
+ def env
138
+ ENV["APP_ENV"] || ENV["RACK_ENV"]
139
+ end
140
+
141
+ #
142
+ # @return [Boolean]
143
+ #
144
+ def development?
145
+ env == "development"
146
+ end
147
+
148
+ #
149
+ # @return [Boolean]
150
+ #
151
+ def sidekiq?
152
+ !Mihari.config.sidekiq_redis_url.nil?
153
+ end
154
+
132
155
  def initialize_sentry
133
156
  return if Mihari.config.sentry_dsn.nil?
134
157
  return if Sentry.initialized?
@@ -136,6 +159,7 @@ module Mihari
136
159
  Sentry.init do |config|
137
160
  config.dsn = Mihari.config.sentry_dsn
138
161
  config.traces_sample_rate = Mihari.config.sentry_trace_sample_rate
162
+ config.breadcrumbs_logger = %i[sentry_logger http_logger]
139
163
  end
140
164
  end
141
165
  end
@@ -154,11 +178,13 @@ require "mihari/rule"
154
178
  # Enrichers
155
179
  require "mihari/enrichers/base"
156
180
  require "mihari/enrichers/google_public_dns"
157
- require "mihari/enrichers/ipinfo"
181
+ require "mihari/enrichers/mmdb"
158
182
  require "mihari/enrichers/shodan"
159
183
  require "mihari/enrichers/whois"
160
184
 
161
185
  # Models
186
+ require "mihari/models/concerns/searchable"
187
+
162
188
  require "mihari/models/alert"
163
189
  require "mihari/models/artifact"
164
190
  require "mihari/models/autonomous_system"
@@ -194,11 +220,13 @@ require "mihari/clients/google_public_dns"
194
220
  require "mihari/clients/greynoise"
195
221
  require "mihari/clients/hunterhow"
196
222
  require "mihari/clients/misp"
223
+ require "mihari/clients/mmdb"
197
224
  require "mihari/clients/onyphe"
198
225
  require "mihari/clients/otx"
199
226
  require "mihari/clients/passivetotal"
200
227
  require "mihari/clients/publsedive"
201
228
  require "mihari/clients/securitytrails"
229
+ require "mihari/clients/shodan_internet_db"
202
230
  require "mihari/clients/shodan"
203
231
  require "mihari/clients/the_hive"
204
232
  require "mihari/clients/urlscan"
@@ -242,8 +270,8 @@ require "mihari/structs/filters"
242
270
  require "mihari/structs/fofa"
243
271
  require "mihari/structs/google_public_dns"
244
272
  require "mihari/structs/greynoise"
245
- require "mihari/structs/ipinfo"
246
273
  require "mihari/structs/hunterhow"
274
+ require "mihari/structs/mmdb"
247
275
  require "mihari/structs/onyphe"
248
276
  require "mihari/structs/shodan"
249
277
  require "mihari/structs/urlscan"
@@ -251,7 +279,7 @@ require "mihari/structs/virustotal_intelligence"
251
279
 
252
280
  # Schemas
253
281
  require "mihari/schemas/macros"
254
- require "mihari/schemas/mixins"
282
+ require "mihari/schemas/concerns/orrable"
255
283
 
256
284
  require "mihari/schemas/options"
257
285
 
@@ -260,13 +288,18 @@ require "mihari/schemas/analyzer"
260
288
  require "mihari/schemas/rule"
261
289
 
262
290
  # Services
263
- require "mihari/services/rule_builder"
264
-
265
- require "mihari/services/alert_builder"
266
- require "mihari/services/alert_runner"
291
+ require "mihari/services/builders"
292
+ require "mihari/services/creators"
293
+ require "mihari/services/destroyers"
294
+ require "mihari/services/enrichers"
295
+ require "mihari/services/feed"
296
+ require "mihari/services/getters"
297
+ require "mihari/services/initializers"
298
+ require "mihari/services/proxies"
299
+ require "mihari/services/searchers"
267
300
 
268
301
  # Entities
269
- require "mihari/entities/message"
302
+ require "mihari/entities/pagination"
270
303
 
271
304
  require "mihari/entities/autonomous_system"
272
305
  require "mihari/entities/config"
@@ -274,6 +307,7 @@ require "mihari/entities/cpe"
274
307
  require "mihari/entities/dns"
275
308
  require "mihari/entities/geolocation"
276
309
  require "mihari/entities/ip_address"
310
+ require "mihari/entities/messages"
277
311
  require "mihari/entities/port"
278
312
  require "mihari/entities/reverse_dns"
279
313
  require "mihari/entities/tag"
@@ -285,11 +319,5 @@ require "mihari/entities/alert"
285
319
 
286
320
  require "mihari/entities/rule"
287
321
 
288
- # Web app
289
- require "mihari/web/app"
290
-
291
- # CLIs
292
- require "mihari/cli/main"
293
-
294
- # initialize Sentry (if it's possible)
322
+ # Initialize Sentry (if it's possible)
295
323
  Mihari.initialize_sentry
data/mihari.gemspec CHANGED
@@ -39,7 +39,9 @@ Gem::Specification.new do |spec|
39
39
  spec.add_development_dependency "better_errors", "~> 2.10"
40
40
  spec.add_development_dependency "binding_of_caller", "~> 1.0"
41
41
  spec.add_development_dependency "bundler", "~> 2.5"
42
+ spec.add_development_dependency "capybara", "~> 3.39"
42
43
  spec.add_development_dependency "coveralls_reborn", "~> 0.28"
44
+ spec.add_development_dependency "factory_bot", "~> 6.4"
43
45
  spec.add_development_dependency "fakefs", "~> 2.5"
44
46
  spec.add_development_dependency "faker", "~> 3.2"
45
47
  spec.add_development_dependency "fuubar", "~> 2.5"
@@ -52,9 +54,11 @@ Gem::Specification.new do |spec|
52
54
  spec.add_development_dependency "rspec", "~> 3.12"
53
55
  spec.add_development_dependency "rspec-parameterized", "~> 1.0"
54
56
  spec.add_development_dependency "rubocop-rspec", "~> 2.25"
55
- spec.add_development_dependency "rubocop-yard", "~> 0.8"
57
+ spec.add_development_dependency "rubocop-yard", "~> 0.9"
58
+ spec.add_development_dependency "rubocop-rake", "~> 0.6"
59
+ spec.add_development_dependency "rubocop-factory_bot", "~> 2.24"
56
60
  spec.add_development_dependency "simplecov-lcov", "~> 0.8"
57
- spec.add_development_dependency "standard", "~> 1.32"
61
+ spec.add_development_dependency "standard", "~> 1.33"
58
62
  spec.add_development_dependency "test-prof", "~> 1.3"
59
63
  spec.add_development_dependency "timecop", "~> 0.9"
60
64
  spec.add_development_dependency "vcr", "~> 6.2"
@@ -93,11 +97,15 @@ Gem::Specification.new do |spec|
93
97
  spec.add_dependency "puma", "6.4.0"
94
98
  spec.add_dependency "rack", "3.0.8"
95
99
  spec.add_dependency "rack-cors", "2.0.1"
100
+ spec.add_dependency "rack-session", "2.0.0"
96
101
  spec.add_dependency "rackup", "2.1.0"
102
+ spec.add_dependency "search_cop", "1.2.3"
97
103
  spec.add_dependency "semantic_logger", "4.15.0"
98
- spec.add_dependency "sentry-ruby", "~> 5.14"
104
+ spec.add_dependency "sentry-ruby", "~> 5.15"
105
+ spec.add_dependency "sentry-sidekiq", "~> 5.15"
106
+ spec.add_dependency "sidekiq", "7.2.0"
99
107
  spec.add_dependency "slack-notifier", "2.4.0"
100
- spec.add_dependency "sqlite3", "~> 1.6"
108
+ spec.add_dependency "sqlite3", "~> 1.7"
101
109
  spec.add_dependency "thor", "1.3.0"
102
110
  spec.add_dependency "thor-hollaback", "0.2.1"
103
111
  spec.add_dependency "uuidtools", "2.2.0"
data/mkdocs.yml CHANGED
@@ -11,11 +11,13 @@ plugins:
11
11
 
12
12
  nav:
13
13
  - Requirements: requirements.md
14
+ - Overview: overview.md
14
15
  - Installation: installation.md
15
- - How to Write a Rule: rule.md
16
- - Usage: usage.md
16
+ - Rule: rule.md
17
17
  - Configuration: configuration.md
18
+ - Usage: usage.md
18
19
  - Tips:
20
+ - Sidekiq: tips/sidekiq.md
19
21
  - Docker: tips/docker.md
20
22
  - GitHub Actions: tips/github_actions.md
21
23
  - Superset: tips/superset.md
@@ -27,6 +29,7 @@ nav:
27
29
  - Emitters: emitters/index.md
28
30
  - Database: database.md
29
31
  - Tags: tags.md
32
+ - Development: dev.md
30
33
 
31
34
  markdown_extensions:
32
35
  - toc:
data/requirements.txt CHANGED
@@ -1,2 +1,2 @@
1
1
  mkdocs==1.5.3
2
- mkdocs-material==9.5.1
2
+ mkdocs-material==9.5.3
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mihari
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.3.0
4
+ version: 7.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manabu Niseki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-16 00:00:00.000000000 Z
11
+ date: 2023-12-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: better_errors
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '2.5'
55
+ - !ruby/object:Gem::Dependency
56
+ name: capybara
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.39'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.39'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: coveralls_reborn
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -66,6 +80,20 @@ dependencies:
66
80
  - - "~>"
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0.28'
83
+ - !ruby/object:Gem::Dependency
84
+ name: factory_bot
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '6.4'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '6.4'
69
97
  - !ruby/object:Gem::Dependency
70
98
  name: fakefs
71
99
  requirement: !ruby/object:Gem::Requirement
@@ -240,14 +268,42 @@ dependencies:
240
268
  requirements:
241
269
  - - "~>"
242
270
  - !ruby/object:Gem::Version
243
- version: '0.8'
271
+ version: '0.9'
244
272
  type: :development
245
273
  prerelease: false
246
274
  version_requirements: !ruby/object:Gem::Requirement
247
275
  requirements:
248
276
  - - "~>"
249
277
  - !ruby/object:Gem::Version
250
- version: '0.8'
278
+ version: '0.9'
279
+ - !ruby/object:Gem::Dependency
280
+ name: rubocop-rake
281
+ requirement: !ruby/object:Gem::Requirement
282
+ requirements:
283
+ - - "~>"
284
+ - !ruby/object:Gem::Version
285
+ version: '0.6'
286
+ type: :development
287
+ prerelease: false
288
+ version_requirements: !ruby/object:Gem::Requirement
289
+ requirements:
290
+ - - "~>"
291
+ - !ruby/object:Gem::Version
292
+ version: '0.6'
293
+ - !ruby/object:Gem::Dependency
294
+ name: rubocop-factory_bot
295
+ requirement: !ruby/object:Gem::Requirement
296
+ requirements:
297
+ - - "~>"
298
+ - !ruby/object:Gem::Version
299
+ version: '2.24'
300
+ type: :development
301
+ prerelease: false
302
+ version_requirements: !ruby/object:Gem::Requirement
303
+ requirements:
304
+ - - "~>"
305
+ - !ruby/object:Gem::Version
306
+ version: '2.24'
251
307
  - !ruby/object:Gem::Dependency
252
308
  name: simplecov-lcov
253
309
  requirement: !ruby/object:Gem::Requirement
@@ -268,14 +324,14 @@ dependencies:
268
324
  requirements:
269
325
  - - "~>"
270
326
  - !ruby/object:Gem::Version
271
- version: '1.32'
327
+ version: '1.33'
272
328
  type: :development
273
329
  prerelease: false
274
330
  version_requirements: !ruby/object:Gem::Requirement
275
331
  requirements:
276
332
  - - "~>"
277
333
  - !ruby/object:Gem::Version
278
- version: '1.32'
334
+ version: '1.33'
279
335
  - !ruby/object:Gem::Dependency
280
336
  name: test-prof
281
337
  requirement: !ruby/object:Gem::Requirement
@@ -710,6 +766,20 @@ dependencies:
710
766
  - - '='
711
767
  - !ruby/object:Gem::Version
712
768
  version: 2.0.1
769
+ - !ruby/object:Gem::Dependency
770
+ name: rack-session
771
+ requirement: !ruby/object:Gem::Requirement
772
+ requirements:
773
+ - - '='
774
+ - !ruby/object:Gem::Version
775
+ version: 2.0.0
776
+ type: :runtime
777
+ prerelease: false
778
+ version_requirements: !ruby/object:Gem::Requirement
779
+ requirements:
780
+ - - '='
781
+ - !ruby/object:Gem::Version
782
+ version: 2.0.0
713
783
  - !ruby/object:Gem::Dependency
714
784
  name: rackup
715
785
  requirement: !ruby/object:Gem::Requirement
@@ -724,6 +794,20 @@ dependencies:
724
794
  - - '='
725
795
  - !ruby/object:Gem::Version
726
796
  version: 2.1.0
797
+ - !ruby/object:Gem::Dependency
798
+ name: search_cop
799
+ requirement: !ruby/object:Gem::Requirement
800
+ requirements:
801
+ - - '='
802
+ - !ruby/object:Gem::Version
803
+ version: 1.2.3
804
+ type: :runtime
805
+ prerelease: false
806
+ version_requirements: !ruby/object:Gem::Requirement
807
+ requirements:
808
+ - - '='
809
+ - !ruby/object:Gem::Version
810
+ version: 1.2.3
727
811
  - !ruby/object:Gem::Dependency
728
812
  name: semantic_logger
729
813
  requirement: !ruby/object:Gem::Requirement
@@ -744,14 +828,42 @@ dependencies:
744
828
  requirements:
745
829
  - - "~>"
746
830
  - !ruby/object:Gem::Version
747
- version: '5.14'
831
+ version: '5.15'
832
+ type: :runtime
833
+ prerelease: false
834
+ version_requirements: !ruby/object:Gem::Requirement
835
+ requirements:
836
+ - - "~>"
837
+ - !ruby/object:Gem::Version
838
+ version: '5.15'
839
+ - !ruby/object:Gem::Dependency
840
+ name: sentry-sidekiq
841
+ requirement: !ruby/object:Gem::Requirement
842
+ requirements:
843
+ - - "~>"
844
+ - !ruby/object:Gem::Version
845
+ version: '5.15'
748
846
  type: :runtime
749
847
  prerelease: false
750
848
  version_requirements: !ruby/object:Gem::Requirement
751
849
  requirements:
752
850
  - - "~>"
753
851
  - !ruby/object:Gem::Version
754
- version: '5.14'
852
+ version: '5.15'
853
+ - !ruby/object:Gem::Dependency
854
+ name: sidekiq
855
+ requirement: !ruby/object:Gem::Requirement
856
+ requirements:
857
+ - - '='
858
+ - !ruby/object:Gem::Version
859
+ version: 7.2.0
860
+ type: :runtime
861
+ prerelease: false
862
+ version_requirements: !ruby/object:Gem::Requirement
863
+ requirements:
864
+ - - '='
865
+ - !ruby/object:Gem::Version
866
+ version: 7.2.0
755
867
  - !ruby/object:Gem::Dependency
756
868
  name: slack-notifier
757
869
  requirement: !ruby/object:Gem::Requirement
@@ -772,14 +884,14 @@ dependencies:
772
884
  requirements:
773
885
  - - "~>"
774
886
  - !ruby/object:Gem::Version
775
- version: '1.6'
887
+ version: '1.7'
776
888
  type: :runtime
777
889
  prerelease: false
778
890
  version_requirements: !ruby/object:Gem::Requirement
779
891
  requirements:
780
892
  - - "~>"
781
893
  - !ruby/object:Gem::Version
782
- version: '1.6'
894
+ version: '1.7'
783
895
  - !ruby/object:Gem::Dependency
784
896
  name: thor
785
897
  requirement: !ruby/object:Gem::Requirement
@@ -862,6 +974,7 @@ files:
862
974
  - ".rspec"
863
975
  - ".rubocop.yml"
864
976
  - ".standard.yml"
977
+ - Dockerfile
865
978
  - Gemfile
866
979
  - LICENSE
867
980
  - README.md
@@ -870,6 +983,7 @@ files:
870
983
  - bin/setup
871
984
  - build_frontend.sh
872
985
  - config.ru
986
+ - docker-compose.yml
873
987
  - exe/mihari
874
988
  - lefthook.yml
875
989
  - lib/mihari.rb
@@ -895,10 +1009,13 @@ files:
895
1009
  - lib/mihari/analyzers/virustotal_intelligence.rb
896
1010
  - lib/mihari/analyzers/zoomeye.rb
897
1011
  - lib/mihari/cli/alert.rb
1012
+ - lib/mihari/cli/application.rb
1013
+ - lib/mihari/cli/artifact.rb
898
1014
  - lib/mihari/cli/base.rb
1015
+ - lib/mihari/cli/config.rb
899
1016
  - lib/mihari/cli/database.rb
900
- - lib/mihari/cli/main.rb
901
1017
  - lib/mihari/cli/rule.rb
1018
+ - lib/mihari/cli/tag.rb
902
1019
  - lib/mihari/clients/base.rb
903
1020
  - lib/mihari/clients/binaryedge.rb
904
1021
  - lib/mihari/clients/censys.rb
@@ -910,23 +1027,35 @@ files:
910
1027
  - lib/mihari/clients/greynoise.rb
911
1028
  - lib/mihari/clients/hunterhow.rb
912
1029
  - lib/mihari/clients/misp.rb
1030
+ - lib/mihari/clients/mmdb.rb
913
1031
  - lib/mihari/clients/onyphe.rb
914
1032
  - lib/mihari/clients/otx.rb
915
1033
  - lib/mihari/clients/passivetotal.rb
916
1034
  - lib/mihari/clients/publsedive.rb
917
1035
  - lib/mihari/clients/securitytrails.rb
918
1036
  - lib/mihari/clients/shodan.rb
1037
+ - lib/mihari/clients/shodan_internet_db.rb
919
1038
  - lib/mihari/clients/the_hive.rb
920
1039
  - lib/mihari/clients/urlscan.rb
921
1040
  - lib/mihari/clients/virustotal.rb
922
1041
  - lib/mihari/clients/zoomeye.rb
923
1042
  - lib/mihari/commands/alert.rb
1043
+ - lib/mihari/commands/artifact.rb
1044
+ - lib/mihari/commands/config.rb
924
1045
  - lib/mihari/commands/database.rb
925
- - lib/mihari/commands/mixins.rb
926
1046
  - lib/mihari/commands/rule.rb
927
1047
  - lib/mihari/commands/search.rb
1048
+ - lib/mihari/commands/sidekiq.rb
1049
+ - lib/mihari/commands/tag.rb
928
1050
  - lib/mihari/commands/version.rb
929
1051
  - lib/mihari/commands/web.rb
1052
+ - lib/mihari/concerns/autonomous_system_normalizable.rb
1053
+ - lib/mihari/concerns/configurable.rb
1054
+ - lib/mihari/concerns/database_connectable.rb
1055
+ - lib/mihari/concerns/error_unwrappable.rb
1056
+ - lib/mihari/concerns/falsepositive_validatable.rb
1057
+ - lib/mihari/concerns/refangable.rb
1058
+ - lib/mihari/concerns/retriable.rb
930
1059
  - lib/mihari/config.rb
931
1060
  - lib/mihari/constants.rb
932
1061
  - lib/mihari/data_type.rb
@@ -939,7 +1068,7 @@ files:
939
1068
  - lib/mihari/emitters/webhook.rb
940
1069
  - lib/mihari/enrichers/base.rb
941
1070
  - lib/mihari/enrichers/google_public_dns.rb
942
- - lib/mihari/enrichers/ipinfo.rb
1071
+ - lib/mihari/enrichers/mmdb.rb
943
1072
  - lib/mihari/enrichers/shodan.rb
944
1073
  - lib/mihari/enrichers/whois.rb
945
1074
  - lib/mihari/entities/alert.rb
@@ -950,25 +1079,19 @@ files:
950
1079
  - lib/mihari/entities/dns.rb
951
1080
  - lib/mihari/entities/geolocation.rb
952
1081
  - lib/mihari/entities/ip_address.rb
953
- - lib/mihari/entities/message.rb
1082
+ - lib/mihari/entities/messages.rb
1083
+ - lib/mihari/entities/pagination.rb
954
1084
  - lib/mihari/entities/port.rb
955
1085
  - lib/mihari/entities/reverse_dns.rb
956
1086
  - lib/mihari/entities/rule.rb
957
1087
  - lib/mihari/entities/tag.rb
958
1088
  - lib/mihari/entities/whois.rb
959
1089
  - lib/mihari/errors.rb
960
- - lib/mihari/feed/parser.rb
961
- - lib/mihari/feed/reader.rb
962
1090
  - lib/mihari/http.rb
963
- - lib/mihari/mixins/autonomous_system.rb
964
- - lib/mihari/mixins/configurable.rb
965
- - lib/mihari/mixins/falsepositive.rb
966
- - lib/mihari/mixins/refang.rb
967
- - lib/mihari/mixins/retriable.rb
968
- - lib/mihari/mixins/unwrap_error.rb
969
1091
  - lib/mihari/models/alert.rb
970
1092
  - lib/mihari/models/artifact.rb
971
1093
  - lib/mihari/models/autonomous_system.rb
1094
+ - lib/mihari/models/concerns/searchable.rb
972
1095
  - lib/mihari/models/cpe.rb
973
1096
  - lib/mihari/models/dns.rb
974
1097
  - lib/mihari/models/geolocation.rb
@@ -981,16 +1104,24 @@ files:
981
1104
  - lib/mihari/rule.rb
982
1105
  - lib/mihari/schemas/alert.rb
983
1106
  - lib/mihari/schemas/analyzer.rb
1107
+ - lib/mihari/schemas/concerns/orrable.rb
984
1108
  - lib/mihari/schemas/emitter.rb
985
1109
  - lib/mihari/schemas/enricher.rb
986
1110
  - lib/mihari/schemas/macros.rb
987
- - lib/mihari/schemas/mixins.rb
988
1111
  - lib/mihari/schemas/options.rb
989
1112
  - lib/mihari/schemas/rule.rb
990
1113
  - lib/mihari/service.rb
991
- - lib/mihari/services/alert_builder.rb
992
- - lib/mihari/services/alert_runner.rb
993
- - lib/mihari/services/rule_builder.rb
1114
+ - lib/mihari/services/builders.rb
1115
+ - lib/mihari/services/creators.rb
1116
+ - lib/mihari/services/destroyers.rb
1117
+ - lib/mihari/services/enrichers.rb
1118
+ - lib/mihari/services/feed.rb
1119
+ - lib/mihari/services/getters.rb
1120
+ - lib/mihari/services/initializers.rb
1121
+ - lib/mihari/services/proxies.rb
1122
+ - lib/mihari/services/searchers.rb
1123
+ - lib/mihari/sidekiq/application.rb
1124
+ - lib/mihari/sidekiq/jobs.rb
994
1125
  - lib/mihari/structs/binaryedge.rb
995
1126
  - lib/mihari/structs/censys.rb
996
1127
  - lib/mihari/structs/config.rb
@@ -999,7 +1130,7 @@ files:
999
1130
  - lib/mihari/structs/google_public_dns.rb
1000
1131
  - lib/mihari/structs/greynoise.rb
1001
1132
  - lib/mihari/structs/hunterhow.rb
1002
- - lib/mihari/structs/ipinfo.rb
1133
+ - lib/mihari/structs/mmdb.rb
1003
1134
  - lib/mihari/structs/onyphe.rb
1004
1135
  - lib/mihari/structs/shodan.rb
1005
1136
  - lib/mihari/structs/urlscan.rb
@@ -1007,18 +1138,17 @@ files:
1007
1138
  - lib/mihari/types.rb
1008
1139
  - lib/mihari/version.rb
1009
1140
  - lib/mihari/web/api.rb
1010
- - lib/mihari/web/app.rb
1141
+ - lib/mihari/web/application.rb
1011
1142
  - lib/mihari/web/endpoints/alerts.rb
1012
1143
  - lib/mihari/web/endpoints/artifacts.rb
1013
1144
  - lib/mihari/web/endpoints/configs.rb
1014
- - lib/mihari/web/endpoints/exports.rb
1015
1145
  - lib/mihari/web/endpoints/ip_addresses.rb
1016
1146
  - lib/mihari/web/endpoints/rules.rb
1017
1147
  - lib/mihari/web/endpoints/tags.rb
1018
- - lib/mihari/web/middleware/connection_adapter.rb
1019
- - lib/mihari/web/middleware/error_notification_adapter.rb
1020
- - lib/mihari/web/public/assets/index-81613_nX.js
1021
- - lib/mihari/web/public/assets/index-Wv6xUrTI.css
1148
+ - lib/mihari/web/middleware/capture_exceptions.rb
1149
+ - lib/mihari/web/middleware/connection.rb
1150
+ - lib/mihari/web/public/assets/index-cQUcyII5.js
1151
+ - lib/mihari/web/public/assets/index-dVaNxqTC.css
1022
1152
  - lib/mihari/web/public/assets/mode-yaml-BC4MIiYj.js
1023
1153
  - lib/mihari/web/public/favicon.ico
1024
1154
  - lib/mihari/web/public/index.html
@@ -1047,7 +1177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1047
1177
  - !ruby/object:Gem::Version
1048
1178
  version: '0'
1049
1179
  requirements: []
1050
- rubygems_version: 3.4.10
1180
+ rubygems_version: 3.5.3
1051
1181
  signing_key:
1052
1182
  specification_version: 4
1053
1183
  summary: A query aggregator for OSINT based threat hunting
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Mihari
4
- module Commands
5
- module Mixins
6
- def with_db_connection(&block)
7
- Mihari::Database.with_db_connection(&block)
8
- end
9
- end
10
- end
11
- end