mihari 5.4.1 → 5.4.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/frontend/package-lock.json +145 -146
  3. data/frontend/package.json +8 -8
  4. data/frontend/src/swagger.yaml +306 -272
  5. data/lib/mihari/analyzers/base.rb +0 -4
  6. data/lib/mihari/analyzers/binaryedge.rb +4 -44
  7. data/lib/mihari/analyzers/censys.rb +4 -20
  8. data/lib/mihari/analyzers/circl.rb +2 -26
  9. data/lib/mihari/analyzers/crtsh.rb +2 -17
  10. data/lib/mihari/analyzers/dnstwister.rb +1 -3
  11. data/lib/mihari/analyzers/greynoise.rb +5 -4
  12. data/lib/mihari/analyzers/hunterhow.rb +8 -23
  13. data/lib/mihari/analyzers/onyphe.rb +5 -39
  14. data/lib/mihari/analyzers/otx.rb +2 -38
  15. data/lib/mihari/analyzers/passivetotal.rb +3 -41
  16. data/lib/mihari/analyzers/securitytrails.rb +3 -41
  17. data/lib/mihari/analyzers/shodan.rb +7 -39
  18. data/lib/mihari/analyzers/urlscan.rb +2 -38
  19. data/lib/mihari/analyzers/virustotal_intelligence.rb +2 -25
  20. data/lib/mihari/analyzers/zoomeye.rb +17 -83
  21. data/lib/mihari/cli/alert.rb +11 -0
  22. data/lib/mihari/cli/main.rb +6 -1
  23. data/lib/mihari/clients/base.rb +9 -1
  24. data/lib/mihari/clients/binaryedge.rb +27 -2
  25. data/lib/mihari/clients/censys.rb +32 -2
  26. data/lib/mihari/clients/circl.rb +28 -1
  27. data/lib/mihari/clients/crtsh.rb +9 -2
  28. data/lib/mihari/clients/dnstwister.rb +4 -2
  29. data/lib/mihari/clients/greynoise.rb +31 -4
  30. data/lib/mihari/clients/hunterhow.rb +41 -3
  31. data/lib/mihari/clients/onyphe.rb +25 -3
  32. data/lib/mihari/clients/otx.rb +40 -0
  33. data/lib/mihari/clients/passivetotal.rb +33 -15
  34. data/lib/mihari/clients/securitytrails.rb +44 -0
  35. data/lib/mihari/clients/shodan.rb +30 -2
  36. data/lib/mihari/clients/urlscan.rb +32 -6
  37. data/lib/mihari/clients/virustotal.rb +29 -4
  38. data/lib/mihari/clients/zoomeye.rb +53 -2
  39. data/lib/mihari/commands/alert.rb +42 -0
  40. data/lib/mihari/commands/rule.rb +2 -2
  41. data/lib/mihari/commands/search.rb +20 -59
  42. data/lib/mihari/commands/web.rb +1 -1
  43. data/lib/mihari/config.rb +2 -2
  44. data/lib/mihari/emitters/base.rb +1 -1
  45. data/lib/mihari/emitters/database.rb +2 -2
  46. data/lib/mihari/errors.rb +23 -2
  47. data/lib/mihari/http.rb +7 -1
  48. data/lib/mihari/schemas/alert.rb +14 -0
  49. data/lib/mihari/services/alert_proxy.rb +106 -0
  50. data/lib/mihari/services/alert_runner.rb +22 -0
  51. data/lib/mihari/services/{rule.rb → rule_proxy.rb} +10 -6
  52. data/lib/mihari/services/rule_runner.rb +49 -0
  53. data/lib/mihari/structs/censys.rb +11 -11
  54. data/lib/mihari/structs/greynoise.rb +17 -8
  55. data/lib/mihari/structs/onyphe.rb +7 -7
  56. data/lib/mihari/structs/shodan.rb +5 -5
  57. data/lib/mihari/structs/urlscan.rb +3 -3
  58. data/lib/mihari/structs/virustotal_intelligence.rb +3 -3
  59. data/lib/mihari/version.rb +1 -1
  60. data/lib/mihari/web/endpoints/alerts.rb +22 -0
  61. data/lib/mihari/web/endpoints/rules.rb +8 -8
  62. data/lib/mihari/web/public/assets/{index-61dc587c.js → index-4d7eda9f.js} +1 -1
  63. data/lib/mihari/web/public/index.html +1 -1
  64. data/lib/mihari/web/public/redoc-static.html +29 -27
  65. data/lib/mihari.rb +6 -1
  66. data/mihari.gemspec +9 -10
  67. metadata +28 -37
  68. data/Steepfile +0 -31
data/lib/mihari.rb CHANGED
@@ -114,7 +114,11 @@ require "mihari/type_checker"
114
114
  require "mihari/http"
115
115
 
116
116
  # Services
117
- require "mihari/services/rule"
117
+ require "mihari/services/rule_proxy"
118
+ require "mihari/services/rule_runner"
119
+
120
+ require "mihari/services/alert_proxy"
121
+ require "mihari/services/alert_runner"
118
122
 
119
123
  # Structs
120
124
  require "mihari/structs/censys"
@@ -132,6 +136,7 @@ require "mihari/structs/virustotal_intelligence"
132
136
  # Schemas
133
137
  require "mihari/schemas/macros"
134
138
 
139
+ require "mihari/schemas/alert"
135
140
  require "mihari/schemas/analyzer"
136
141
  require "mihari/schemas/rule"
137
142
 
data/mihari.gemspec CHANGED
@@ -47,29 +47,28 @@ Gem::Specification.new do |spec|
47
47
  spec.add_development_dependency "rb-fsevent", "~> 0.11"
48
48
  spec.add_development_dependency "rerun", "~> 0.14"
49
49
  spec.add_development_dependency "rspec", "~> 3.12"
50
- spec.add_development_dependency "simplecov-lcov", "~> 0.8.0"
51
- spec.add_development_dependency "standard", "~> 1.30"
50
+ spec.add_development_dependency "simplecov-lcov", "~> 0.8"
51
+ spec.add_development_dependency "standard", "~> 1.31"
52
52
  spec.add_development_dependency "timecop", "~> 0.9"
53
53
  spec.add_development_dependency "vcr", "~> 6.2"
54
- spec.add_development_dependency "webmock", "~> 3.18"
54
+ spec.add_development_dependency "webmock", "~> 3.19"
55
55
 
56
56
  unless ci_env?
57
57
  spec.add_development_dependency "lefthook", "~> 1.4"
58
58
  spec.add_development_dependency "solargraph", "~> 0.49"
59
- spec.add_development_dependency "steep", "~> 1.4"
60
59
  end
61
60
 
62
- spec.add_dependency "activerecord", "7.0.7"
61
+ spec.add_dependency "activerecord", "7.0.7.2"
63
62
  spec.add_dependency "addressable", "2.8.5"
64
63
  spec.add_dependency "awrence", "2.0.1"
65
64
  spec.add_dependency "dotenv", "2.8.1"
66
65
  spec.add_dependency "dry-container", "0.11.0"
67
66
  spec.add_dependency "dry-files", "1.0.1"
68
- spec.add_dependency "dry-schema", "1.13.2"
67
+ spec.add_dependency "dry-schema", "1.13.3"
69
68
  spec.add_dependency "dry-struct", "1.6.0"
70
69
  spec.add_dependency "dry-validation", "1.10.0"
71
70
  spec.add_dependency "email_address", "0.2.4"
72
- spec.add_dependency "grape", "1.7.0"
71
+ spec.add_dependency "grape", "1.8.0"
73
72
  spec.add_dependency "grape-entity", "1.0.0"
74
73
  spec.add_dependency "grape-swagger", "1.6.1"
75
74
  spec.add_dependency "grape-swagger-entity", "0.5.2"
@@ -82,14 +81,14 @@ Gem::Specification.new do |spec|
82
81
  spec.add_dependency "parallel", "1.23.0"
83
82
  spec.add_dependency "plissken", "2.0.1"
84
83
  spec.add_dependency "public_suffix", "5.0.3"
85
- spec.add_dependency "puma", "6.3.0"
84
+ spec.add_dependency "puma", "6.3.1"
86
85
  spec.add_dependency "rack", "3.0.8"
87
86
  spec.add_dependency "rack-cors", "2.0.1"
88
87
  spec.add_dependency "rackup", "2.1.0"
89
88
  spec.add_dependency "semantic_logger", "4.14.0"
90
- spec.add_dependency "sentry-ruby", "5.10.0"
89
+ spec.add_dependency "sentry-ruby", "5.11.0"
91
90
  spec.add_dependency "slack-notifier", "2.4.0"
92
- spec.add_dependency "sqlite3", "1.6.3"
91
+ spec.add_dependency "sqlite3", "1.6.4"
93
92
  spec.add_dependency "thor", "1.2.2"
94
93
  spec.add_dependency "uuidtools", "2.2.0"
95
94
  spec.add_dependency "whois", "5.1.0"
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: 5.4.1
4
+ version: 5.4.3
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-08-12 00:00:00.000000000 Z
11
+ date: 2023-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -170,28 +170,28 @@ dependencies:
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: 0.8.0
173
+ version: '0.8'
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: 0.8.0
180
+ version: '0.8'
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: standard
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
185
  - - "~>"
186
186
  - !ruby/object:Gem::Version
187
- version: '1.30'
187
+ version: '1.31'
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - "~>"
193
193
  - !ruby/object:Gem::Version
194
- version: '1.30'
194
+ version: '1.31'
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: timecop
197
197
  requirement: !ruby/object:Gem::Requirement
@@ -226,14 +226,14 @@ dependencies:
226
226
  requirements:
227
227
  - - "~>"
228
228
  - !ruby/object:Gem::Version
229
- version: '3.18'
229
+ version: '3.19'
230
230
  type: :development
231
231
  prerelease: false
232
232
  version_requirements: !ruby/object:Gem::Requirement
233
233
  requirements:
234
234
  - - "~>"
235
235
  - !ruby/object:Gem::Version
236
- version: '3.18'
236
+ version: '3.19'
237
237
  - !ruby/object:Gem::Dependency
238
238
  name: lefthook
239
239
  requirement: !ruby/object:Gem::Requirement
@@ -262,34 +262,20 @@ dependencies:
262
262
  - - "~>"
263
263
  - !ruby/object:Gem::Version
264
264
  version: '0.49'
265
- - !ruby/object:Gem::Dependency
266
- name: steep
267
- requirement: !ruby/object:Gem::Requirement
268
- requirements:
269
- - - "~>"
270
- - !ruby/object:Gem::Version
271
- version: '1.4'
272
- type: :development
273
- prerelease: false
274
- version_requirements: !ruby/object:Gem::Requirement
275
- requirements:
276
- - - "~>"
277
- - !ruby/object:Gem::Version
278
- version: '1.4'
279
265
  - !ruby/object:Gem::Dependency
280
266
  name: activerecord
281
267
  requirement: !ruby/object:Gem::Requirement
282
268
  requirements:
283
269
  - - '='
284
270
  - !ruby/object:Gem::Version
285
- version: 7.0.7
271
+ version: 7.0.7.2
286
272
  type: :runtime
287
273
  prerelease: false
288
274
  version_requirements: !ruby/object:Gem::Requirement
289
275
  requirements:
290
276
  - - '='
291
277
  - !ruby/object:Gem::Version
292
- version: 7.0.7
278
+ version: 7.0.7.2
293
279
  - !ruby/object:Gem::Dependency
294
280
  name: addressable
295
281
  requirement: !ruby/object:Gem::Requirement
@@ -366,14 +352,14 @@ dependencies:
366
352
  requirements:
367
353
  - - '='
368
354
  - !ruby/object:Gem::Version
369
- version: 1.13.2
355
+ version: 1.13.3
370
356
  type: :runtime
371
357
  prerelease: false
372
358
  version_requirements: !ruby/object:Gem::Requirement
373
359
  requirements:
374
360
  - - '='
375
361
  - !ruby/object:Gem::Version
376
- version: 1.13.2
362
+ version: 1.13.3
377
363
  - !ruby/object:Gem::Dependency
378
364
  name: dry-struct
379
365
  requirement: !ruby/object:Gem::Requirement
@@ -422,14 +408,14 @@ dependencies:
422
408
  requirements:
423
409
  - - '='
424
410
  - !ruby/object:Gem::Version
425
- version: 1.7.0
411
+ version: 1.8.0
426
412
  type: :runtime
427
413
  prerelease: false
428
414
  version_requirements: !ruby/object:Gem::Requirement
429
415
  requirements:
430
416
  - - '='
431
417
  - !ruby/object:Gem::Version
432
- version: 1.7.0
418
+ version: 1.8.0
433
419
  - !ruby/object:Gem::Dependency
434
420
  name: grape-entity
435
421
  requirement: !ruby/object:Gem::Requirement
@@ -604,14 +590,14 @@ dependencies:
604
590
  requirements:
605
591
  - - '='
606
592
  - !ruby/object:Gem::Version
607
- version: 6.3.0
593
+ version: 6.3.1
608
594
  type: :runtime
609
595
  prerelease: false
610
596
  version_requirements: !ruby/object:Gem::Requirement
611
597
  requirements:
612
598
  - - '='
613
599
  - !ruby/object:Gem::Version
614
- version: 6.3.0
600
+ version: 6.3.1
615
601
  - !ruby/object:Gem::Dependency
616
602
  name: rack
617
603
  requirement: !ruby/object:Gem::Requirement
@@ -674,14 +660,14 @@ dependencies:
674
660
  requirements:
675
661
  - - '='
676
662
  - !ruby/object:Gem::Version
677
- version: 5.10.0
663
+ version: 5.11.0
678
664
  type: :runtime
679
665
  prerelease: false
680
666
  version_requirements: !ruby/object:Gem::Requirement
681
667
  requirements:
682
668
  - - '='
683
669
  - !ruby/object:Gem::Version
684
- version: 5.10.0
670
+ version: 5.11.0
685
671
  - !ruby/object:Gem::Dependency
686
672
  name: slack-notifier
687
673
  requirement: !ruby/object:Gem::Requirement
@@ -702,14 +688,14 @@ dependencies:
702
688
  requirements:
703
689
  - - '='
704
690
  - !ruby/object:Gem::Version
705
- version: 1.6.3
691
+ version: 1.6.4
706
692
  type: :runtime
707
693
  prerelease: false
708
694
  version_requirements: !ruby/object:Gem::Requirement
709
695
  requirements:
710
696
  - - '='
711
697
  - !ruby/object:Gem::Version
712
- version: 1.6.3
698
+ version: 1.6.4
713
699
  - !ruby/object:Gem::Dependency
714
700
  name: thor
715
701
  requirement: !ruby/object:Gem::Requirement
@@ -782,7 +768,6 @@ files:
782
768
  - LICENSE
783
769
  - README.md
784
770
  - Rakefile
785
- - Steepfile
786
771
  - bin/console
787
772
  - bin/setup
788
773
  - build_frontend.sh
@@ -896,6 +881,7 @@ files:
896
881
  - lib/mihari/analyzers/virustotal.rb
897
882
  - lib/mihari/analyzers/virustotal_intelligence.rb
898
883
  - lib/mihari/analyzers/zoomeye.rb
884
+ - lib/mihari/cli/alert.rb
899
885
  - lib/mihari/cli/base.rb
900
886
  - lib/mihari/cli/database.rb
901
887
  - lib/mihari/cli/main.rb
@@ -919,6 +905,7 @@ files:
919
905
  - lib/mihari/clients/urlscan.rb
920
906
  - lib/mihari/clients/virustotal.rb
921
907
  - lib/mihari/clients/zoomeye.rb
908
+ - lib/mihari/commands/alert.rb
922
909
  - lib/mihari/commands/database.rb
923
910
  - lib/mihari/commands/rule.rb
924
911
  - lib/mihari/commands/search.rb
@@ -974,12 +961,16 @@ files:
974
961
  - lib/mihari/models/tag.rb
975
962
  - lib/mihari/models/tagging.rb
976
963
  - lib/mihari/models/whois.rb
964
+ - lib/mihari/schemas/alert.rb
977
965
  - lib/mihari/schemas/analyzer.rb
978
966
  - lib/mihari/schemas/emitter.rb
979
967
  - lib/mihari/schemas/enricher.rb
980
968
  - lib/mihari/schemas/macros.rb
981
969
  - lib/mihari/schemas/rule.rb
982
- - lib/mihari/services/rule.rb
970
+ - lib/mihari/services/alert_proxy.rb
971
+ - lib/mihari/services/alert_runner.rb
972
+ - lib/mihari/services/rule_proxy.rb
973
+ - lib/mihari/services/rule_runner.rb
983
974
  - lib/mihari/structs/censys.rb
984
975
  - lib/mihari/structs/config.rb
985
976
  - lib/mihari/structs/filters.rb
@@ -1006,7 +997,7 @@ files:
1006
997
  - lib/mihari/web/middleware/connection_adapter.rb
1007
998
  - lib/mihari/web/middleware/error_notification_adapter.rb
1008
999
  - lib/mihari/web/public/assets/index-33165282.css
1009
- - lib/mihari/web/public/assets/index-61dc587c.js
1000
+ - lib/mihari/web/public/assets/index-4d7eda9f.js
1010
1001
  - lib/mihari/web/public/assets/mode-yaml-a21faa53.js
1011
1002
  - lib/mihari/web/public/favicon.ico
1012
1003
  - lib/mihari/web/public/index.html
data/Steepfile DELETED
@@ -1,31 +0,0 @@
1
- target :lib do
2
- check "lib"
3
-
4
- repo_path "vendor/rbs/gem_rbs_collection/gems"
5
-
6
- library "date"
7
- library "json"
8
- library "logger"
9
- library "monitor"
10
- library "mutex_m"
11
- library "pathname"
12
- library "securerandom"
13
- library "singleton"
14
- library "time"
15
- library "tsort"
16
- library "uri"
17
- library "resolv"
18
- library "timeout"
19
- library "socket"
20
-
21
- library "rack"
22
-
23
- library "actionpack"
24
- library "actionview"
25
- library "activejob"
26
- library "activemodel"
27
- library "activerecord"
28
- library "activesupport"
29
- library "parallel"
30
- library "railties"
31
- end