mihari 7.1.0 → 7.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +2 -0
  3. data/README.md +2 -1
  4. data/Rakefile +39 -1
  5. data/lib/mihari/actor.rb +5 -5
  6. data/lib/mihari/analyzers/base.rb +18 -11
  7. data/lib/mihari/analyzers/passivetotal.rb +1 -1
  8. data/lib/mihari/analyzers/securitytrails.rb +1 -1
  9. data/lib/mihari/analyzers/virustotal.rb +1 -1
  10. data/lib/mihari/analyzers/virustotal_intelligence.rb +2 -2
  11. data/lib/mihari/cli/application.rb +16 -4
  12. data/lib/mihari/commands/alert.rb +5 -5
  13. data/lib/mihari/commands/artifact.rb +5 -5
  14. data/lib/mihari/commands/rule.rb +6 -6
  15. data/lib/mihari/commands/search.rb +1 -1
  16. data/lib/mihari/commands/tag.rb +3 -3
  17. data/lib/mihari/concerns/retriable.rb +1 -1
  18. data/lib/mihari/constants.rb +1 -1
  19. data/lib/mihari/database.rb +1 -1
  20. data/lib/mihari/emitters/base.rb +15 -1
  21. data/lib/mihari/emitters/database.rb +4 -0
  22. data/lib/mihari/emitters/misp.rb +7 -0
  23. data/lib/mihari/emitters/slack.rb +7 -0
  24. data/lib/mihari/emitters/the_hive.rb +7 -0
  25. data/lib/mihari/emitters/webhook.rb +7 -0
  26. data/lib/mihari/enrichers/base.rb +9 -1
  27. data/lib/mihari/enrichers/google_public_dns.rb +1 -1
  28. data/lib/mihari/rule.rb +2 -14
  29. data/lib/mihari/schemas/analyzer.rb +19 -19
  30. data/lib/mihari/schemas/emitter.rb +5 -5
  31. data/lib/mihari/schemas/enricher.rb +4 -4
  32. data/lib/mihari/structs/config.rb +1 -1
  33. data/lib/mihari/version.rb +1 -1
  34. data/lib/mihari/web/public/assets/{index-U5u7qHZZ.js → index-Guw2aMpk.js} +53 -53
  35. data/lib/mihari/web/public/index.html +1 -1
  36. data/lib/mihari/web/public/redoc-static.html +28 -28
  37. data/lib/mihari.rb +14 -3
  38. data/mihari.gemspec +4 -4
  39. data/mkdocs.yml +1 -1
  40. metadata +57 -15
data/lib/mihari.rb CHANGED
@@ -79,7 +79,7 @@ module Mihari
79
79
  #
80
80
  def emitter_to_class
81
81
  @emitter_to_class ||= emitters.flat_map do |klass|
82
- klass.class_keys.map { |key| [key, klass] }
82
+ klass.keys.map { |key| [key, klass] }
83
83
  end.to_h
84
84
  end
85
85
 
@@ -96,7 +96,7 @@ module Mihari
96
96
  #
97
97
  def analyzer_to_class
98
98
  @analyzer_to_class ||= analyzers.flat_map do |klass|
99
- klass.class_keys.map { |key| [key, klass] }
99
+ klass.keys.map { |key| [key, klass] }
100
100
  end.to_h
101
101
  end
102
102
 
@@ -113,7 +113,7 @@ module Mihari
113
113
  #
114
114
  def enricher_to_class
115
115
  @enricher_to_class ||= enrichers.flat_map do |klass|
116
- klass.class_keys.map { |key| [key, klass] }
116
+ klass.keys.map { |key| [key, klass] }
117
117
  end.to_h
118
118
  end
119
119
 
@@ -125,6 +125,8 @@ module Mihari
125
125
  end
126
126
 
127
127
  def logger
128
+ SemanticLogger.sync! unless puma?
129
+
128
130
  SemanticLogger.default_level = :info
129
131
  SemanticLogger.add_appender(io: $stderr, formatter: :color)
130
132
  SemanticLogger["Mihari"]
@@ -152,6 +154,15 @@ module Mihari
152
154
  !Mihari.config.sidekiq_redis_url.nil?
153
155
  end
154
156
 
157
+ #
158
+ # @return [Boolean]
159
+ #
160
+ def puma?
161
+ !Puma.stats.nil?
162
+ rescue StandardError
163
+ false
164
+ end
165
+
155
166
  def initialize_sentry
156
167
  return if Mihari.config.sentry_dsn.nil?
157
168
  return if Sentry.initialized?
data/mihari.gemspec CHANGED
@@ -72,7 +72,7 @@ Gem::Specification.new do |spec|
72
72
 
73
73
  spec.add_dependency "activerecord", "7.1.2"
74
74
  spec.add_dependency "addressable", "~> 2.8"
75
- spec.add_dependency "anyway_config", "2.5.4"
75
+ spec.add_dependency "anyway_config", "2.6.2"
76
76
  spec.add_dependency "awrence", "2.0.1"
77
77
  spec.add_dependency "csv", "~> 3.2"
78
78
  spec.add_dependency "dotenv", "2.8.1"
@@ -96,15 +96,15 @@ Gem::Specification.new do |spec|
96
96
  spec.add_dependency "parallel", "1.24.0"
97
97
  spec.add_dependency "plissken", "2.0.1"
98
98
  spec.add_dependency "public_suffix", "5.0.4"
99
- spec.add_dependency "puma", "6.4.1"
99
+ spec.add_dependency "puma", "6.4.2"
100
100
  spec.add_dependency "rack", "3.0.8"
101
101
  spec.add_dependency "rack-cors", "2.0.1"
102
102
  spec.add_dependency "rack-session", "2.0.0"
103
103
  spec.add_dependency "rackup", "2.1.0"
104
104
  spec.add_dependency "search_cop", "1.2.3"
105
105
  spec.add_dependency "semantic_logger", "4.15.0"
106
- spec.add_dependency "sentry-ruby", "~> 5.15"
107
- spec.add_dependency "sentry-sidekiq", "~> 5.15"
106
+ spec.add_dependency "sentry-ruby", "~> 5.16"
107
+ spec.add_dependency "sentry-sidekiq", "~> 5.16"
108
108
  spec.add_dependency "sidekiq", "7.2.0"
109
109
  spec.add_dependency "slack-notifier", "2.4.0"
110
110
  spec.add_dependency "sqlite3", "~> 1.7"
data/mkdocs.yml CHANGED
@@ -27,7 +27,7 @@ nav:
27
27
  - Analyzers: analyzers/index.md
28
28
  - Enrichers: enrichers/index.md
29
29
  - Emitters: emitters/index.md
30
- - Database: database.md
30
+ - Diagrams: diagrams.md
31
31
  - Tags: tags.md
32
32
  - Development: dev.md
33
33
 
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: 7.1.0
4
+ version: 7.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manabu Niseki
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-01-06 00:00:00.000000000 Z
11
+ date: 2024-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: better_errors
@@ -388,6 +388,48 @@ dependencies:
388
388
  - - "~>"
389
389
  - !ruby/object:Gem::Version
390
390
  version: '3.19'
391
+ - !ruby/object:Gem::Dependency
392
+ name: lefthook
393
+ requirement: !ruby/object:Gem::Requirement
394
+ requirements:
395
+ - - "~>"
396
+ - !ruby/object:Gem::Version
397
+ version: '1.5'
398
+ type: :development
399
+ prerelease: false
400
+ version_requirements: !ruby/object:Gem::Requirement
401
+ requirements:
402
+ - - "~>"
403
+ - !ruby/object:Gem::Version
404
+ version: '1.5'
405
+ - !ruby/object:Gem::Dependency
406
+ name: ruby-lsp-rspec
407
+ requirement: !ruby/object:Gem::Requirement
408
+ requirements:
409
+ - - "~>"
410
+ - !ruby/object:Gem::Version
411
+ version: '0.1'
412
+ type: :development
413
+ prerelease: false
414
+ version_requirements: !ruby/object:Gem::Requirement
415
+ requirements:
416
+ - - "~>"
417
+ - !ruby/object:Gem::Version
418
+ version: '0.1'
419
+ - !ruby/object:Gem::Dependency
420
+ name: solargraph
421
+ requirement: !ruby/object:Gem::Requirement
422
+ requirements:
423
+ - - "~>"
424
+ - !ruby/object:Gem::Version
425
+ version: '0.50'
426
+ type: :development
427
+ prerelease: false
428
+ version_requirements: !ruby/object:Gem::Requirement
429
+ requirements:
430
+ - - "~>"
431
+ - !ruby/object:Gem::Version
432
+ version: '0.50'
391
433
  - !ruby/object:Gem::Dependency
392
434
  name: activerecord
393
435
  requirement: !ruby/object:Gem::Requirement
@@ -422,14 +464,14 @@ dependencies:
422
464
  requirements:
423
465
  - - '='
424
466
  - !ruby/object:Gem::Version
425
- version: 2.5.4
467
+ version: 2.6.2
426
468
  type: :runtime
427
469
  prerelease: false
428
470
  version_requirements: !ruby/object:Gem::Requirement
429
471
  requirements:
430
472
  - - '='
431
473
  - !ruby/object:Gem::Version
432
- version: 2.5.4
474
+ version: 2.6.2
433
475
  - !ruby/object:Gem::Dependency
434
476
  name: awrence
435
477
  requirement: !ruby/object:Gem::Requirement
@@ -758,14 +800,14 @@ dependencies:
758
800
  requirements:
759
801
  - - '='
760
802
  - !ruby/object:Gem::Version
761
- version: 6.4.1
803
+ version: 6.4.2
762
804
  type: :runtime
763
805
  prerelease: false
764
806
  version_requirements: !ruby/object:Gem::Requirement
765
807
  requirements:
766
808
  - - '='
767
809
  - !ruby/object:Gem::Version
768
- version: 6.4.1
810
+ version: 6.4.2
769
811
  - !ruby/object:Gem::Dependency
770
812
  name: rack
771
813
  requirement: !ruby/object:Gem::Requirement
@@ -856,28 +898,28 @@ dependencies:
856
898
  requirements:
857
899
  - - "~>"
858
900
  - !ruby/object:Gem::Version
859
- version: '5.15'
901
+ version: '5.16'
860
902
  type: :runtime
861
903
  prerelease: false
862
904
  version_requirements: !ruby/object:Gem::Requirement
863
905
  requirements:
864
906
  - - "~>"
865
907
  - !ruby/object:Gem::Version
866
- version: '5.15'
908
+ version: '5.16'
867
909
  - !ruby/object:Gem::Dependency
868
910
  name: sentry-sidekiq
869
911
  requirement: !ruby/object:Gem::Requirement
870
912
  requirements:
871
913
  - - "~>"
872
914
  - !ruby/object:Gem::Version
873
- version: '5.15'
915
+ version: '5.16'
874
916
  type: :runtime
875
917
  prerelease: false
876
918
  version_requirements: !ruby/object:Gem::Requirement
877
919
  requirements:
878
920
  - - "~>"
879
921
  - !ruby/object:Gem::Version
880
- version: '5.15'
922
+ version: '5.16'
881
923
  - !ruby/object:Gem::Dependency
882
924
  name: sidekiq
883
925
  requirement: !ruby/object:Gem::Requirement
@@ -1018,7 +1060,7 @@ dependencies:
1018
1060
  - - '='
1019
1061
  - !ruby/object:Gem::Version
1020
1062
  version: 2.0.0
1021
- description:
1063
+ description:
1022
1064
  email:
1023
1065
  - manabu.niseki@gmail.com
1024
1066
  executables:
@@ -1204,7 +1246,7 @@ files:
1204
1246
  - lib/mihari/web/endpoints/tags.rb
1205
1247
  - lib/mihari/web/middleware/capture_exceptions.rb
1206
1248
  - lib/mihari/web/middleware/connection.rb
1207
- - lib/mihari/web/public/assets/index-U5u7qHZZ.js
1249
+ - lib/mihari/web/public/assets/index-Guw2aMpk.js
1208
1250
  - lib/mihari/web/public/assets/index-dVaNxqTC.css
1209
1251
  - lib/mihari/web/public/assets/mode-yaml-BC4MIiYj.js
1210
1252
  - lib/mihari/web/public/favicon.ico
@@ -1220,7 +1262,7 @@ licenses:
1220
1262
  - MIT
1221
1263
  metadata:
1222
1264
  rubygems_mfa_required: 'true'
1223
- post_install_message:
1265
+ post_install_message:
1224
1266
  rdoc_options: []
1225
1267
  require_paths:
1226
1268
  - lib
@@ -1236,7 +1278,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1236
1278
  version: '0'
1237
1279
  requirements: []
1238
1280
  rubygems_version: 3.5.3
1239
- signing_key:
1281
+ signing_key:
1240
1282
  specification_version: 4
1241
1283
  summary: A query aggregator for OSINT based threat hunting
1242
1284
  test_files: []