mihari 5.4.3 → 5.4.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/frontend/package-lock.json +2399 -1504
  3. data/frontend/package.json +22 -22
  4. data/lib/mihari/analyzers/base.rb +25 -10
  5. data/lib/mihari/analyzers/binaryedge.rb +1 -7
  6. data/lib/mihari/analyzers/circl.rb +1 -1
  7. data/lib/mihari/analyzers/dnstwister.rb +1 -1
  8. data/lib/mihari/analyzers/otx.rb +1 -1
  9. data/lib/mihari/analyzers/passivetotal.rb +1 -1
  10. data/lib/mihari/analyzers/pulsedive.rb +1 -1
  11. data/lib/mihari/analyzers/rule.rb +18 -13
  12. data/lib/mihari/analyzers/securitytrails.rb +1 -1
  13. data/lib/mihari/analyzers/urlscan.rb +1 -1
  14. data/lib/mihari/analyzers/virustotal.rb +1 -1
  15. data/lib/mihari/analyzers/zoomeye.rb +1 -1
  16. data/lib/mihari/clients/binaryedge.rb +4 -7
  17. data/lib/mihari/clients/crtsh.rb +1 -3
  18. data/lib/mihari/clients/publsedive.rb +1 -1
  19. data/lib/mihari/clients/shodan.rb +2 -2
  20. data/lib/mihari/commands/alert.rb +42 -13
  21. data/lib/mihari/commands/rule.rb +11 -7
  22. data/lib/mihari/commands/search.rb +54 -22
  23. data/lib/mihari/config.rb +5 -0
  24. data/lib/mihari/emitters/base.rb +9 -3
  25. data/lib/mihari/emitters/slack.rb +1 -1
  26. data/lib/mihari/enrichers/base.rb +13 -0
  27. data/lib/mihari/enrichers/google_public_dns.rb +16 -1
  28. data/lib/mihari/enrichers/ipinfo.rb +9 -13
  29. data/lib/mihari/enrichers/shodan.rb +1 -2
  30. data/lib/mihari/enrichers/whois.rb +2 -2
  31. data/lib/mihari/errors.rb +16 -10
  32. data/lib/mihari/feed/parser.rb +2 -2
  33. data/lib/mihari/models/artifact.rb +1 -1
  34. data/lib/mihari/models/autonomous_system.rb +11 -5
  35. data/lib/mihari/models/cpe.rb +10 -4
  36. data/lib/mihari/models/dns.rb +11 -16
  37. data/lib/mihari/models/geolocation.rb +11 -5
  38. data/lib/mihari/models/port.rb +10 -4
  39. data/lib/mihari/models/reverse_dns.rb +10 -4
  40. data/lib/mihari/models/whois.rb +4 -1
  41. data/lib/mihari/schemas/analyzer.rb +1 -0
  42. data/lib/mihari/services/alert_builder.rb +43 -0
  43. data/lib/mihari/services/alert_proxy.rb +7 -25
  44. data/lib/mihari/services/alert_runner.rb +9 -0
  45. data/lib/mihari/services/rule_builder.rb +47 -0
  46. data/lib/mihari/services/rule_proxy.rb +5 -61
  47. data/lib/mihari/services/rule_runner.rb +9 -4
  48. data/lib/mihari/structs/binaryedge.rb +89 -0
  49. data/lib/mihari/structs/shodan.rb +2 -1
  50. data/lib/mihari/structs/urlscan.rb +1 -3
  51. data/lib/mihari/structs/virustotal_intelligence.rb +1 -3
  52. data/lib/mihari/type_checker.rb +1 -1
  53. data/lib/mihari/version.rb +1 -1
  54. data/lib/mihari/web/endpoints/alerts.rb +33 -15
  55. data/lib/mihari/web/endpoints/artifacts.rb +53 -25
  56. data/lib/mihari/web/endpoints/configs.rb +2 -2
  57. data/lib/mihari/web/endpoints/ip_addresses.rb +3 -5
  58. data/lib/mihari/web/endpoints/rules.rb +97 -71
  59. data/lib/mihari/web/endpoints/tags.rb +15 -5
  60. data/lib/mihari/web/public/assets/index-ef33a6cd.js +1738 -0
  61. data/lib/mihari/web/public/index.html +1 -1
  62. data/lib/mihari/web/public/redoc-static.html +419 -382
  63. data/lib/mihari.rb +4 -0
  64. data/mihari.gemspec +5 -4
  65. metadata +28 -11
  66. data/lib/mihari/web/public/assets/index-4d7eda9f.js +0 -1738
data/lib/mihari.rb CHANGED
@@ -20,6 +20,7 @@ require "active_record"
20
20
 
21
21
  # dry-rb
22
22
  require "dry/files"
23
+ require "dry/monads"
23
24
  require "dry/schema"
24
25
  require "dry/struct"
25
26
  require "dry/types"
@@ -114,13 +115,16 @@ require "mihari/type_checker"
114
115
  require "mihari/http"
115
116
 
116
117
  # Services
118
+ require "mihari/services/rule_builder"
117
119
  require "mihari/services/rule_proxy"
118
120
  require "mihari/services/rule_runner"
119
121
 
122
+ require "mihari/services/alert_builder"
120
123
  require "mihari/services/alert_proxy"
121
124
  require "mihari/services/alert_runner"
122
125
 
123
126
  # Structs
127
+ require "mihari/structs/binaryedge"
124
128
  require "mihari/structs/censys"
125
129
  require "mihari/structs/config"
126
130
  require "mihari/structs/filters"
data/mihari.gemspec CHANGED
@@ -54,16 +54,17 @@ Gem::Specification.new do |spec|
54
54
  spec.add_development_dependency "webmock", "~> 3.19"
55
55
 
56
56
  unless ci_env?
57
- spec.add_development_dependency "lefthook", "~> 1.4"
57
+ spec.add_development_dependency "lefthook", "~> 1.5"
58
58
  spec.add_development_dependency "solargraph", "~> 0.49"
59
59
  end
60
60
 
61
- spec.add_dependency "activerecord", "7.0.7.2"
61
+ spec.add_dependency "activerecord", "7.0.8"
62
62
  spec.add_dependency "addressable", "2.8.5"
63
63
  spec.add_dependency "awrence", "2.0.1"
64
64
  spec.add_dependency "dotenv", "2.8.1"
65
65
  spec.add_dependency "dry-container", "0.11.0"
66
66
  spec.add_dependency "dry-files", "1.0.1"
67
+ spec.add_dependency "dry-monads", "1.6.0"
67
68
  spec.add_dependency "dry-schema", "1.13.3"
68
69
  spec.add_dependency "dry-struct", "1.6.0"
69
70
  spec.add_dependency "dry-validation", "1.10.0"
@@ -81,14 +82,14 @@ Gem::Specification.new do |spec|
81
82
  spec.add_dependency "parallel", "1.23.0"
82
83
  spec.add_dependency "plissken", "2.0.1"
83
84
  spec.add_dependency "public_suffix", "5.0.3"
84
- spec.add_dependency "puma", "6.3.1"
85
+ spec.add_dependency "puma", "6.4.0"
85
86
  spec.add_dependency "rack", "3.0.8"
86
87
  spec.add_dependency "rack-cors", "2.0.1"
87
88
  spec.add_dependency "rackup", "2.1.0"
88
89
  spec.add_dependency "semantic_logger", "4.14.0"
89
90
  spec.add_dependency "sentry-ruby", "5.11.0"
90
91
  spec.add_dependency "slack-notifier", "2.4.0"
91
- spec.add_dependency "sqlite3", "1.6.4"
92
+ spec.add_dependency "sqlite3", "1.6.6"
92
93
  spec.add_dependency "thor", "1.2.2"
93
94
  spec.add_dependency "uuidtools", "2.2.0"
94
95
  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.3
4
+ version: 5.4.4
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-09-09 00:00:00.000000000 Z
11
+ date: 2023-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -240,14 +240,14 @@ dependencies:
240
240
  requirements:
241
241
  - - "~>"
242
242
  - !ruby/object:Gem::Version
243
- version: '1.4'
243
+ version: '1.5'
244
244
  type: :development
245
245
  prerelease: false
246
246
  version_requirements: !ruby/object:Gem::Requirement
247
247
  requirements:
248
248
  - - "~>"
249
249
  - !ruby/object:Gem::Version
250
- version: '1.4'
250
+ version: '1.5'
251
251
  - !ruby/object:Gem::Dependency
252
252
  name: solargraph
253
253
  requirement: !ruby/object:Gem::Requirement
@@ -268,14 +268,14 @@ dependencies:
268
268
  requirements:
269
269
  - - '='
270
270
  - !ruby/object:Gem::Version
271
- version: 7.0.7.2
271
+ version: 7.0.8
272
272
  type: :runtime
273
273
  prerelease: false
274
274
  version_requirements: !ruby/object:Gem::Requirement
275
275
  requirements:
276
276
  - - '='
277
277
  - !ruby/object:Gem::Version
278
- version: 7.0.7.2
278
+ version: 7.0.8
279
279
  - !ruby/object:Gem::Dependency
280
280
  name: addressable
281
281
  requirement: !ruby/object:Gem::Requirement
@@ -346,6 +346,20 @@ dependencies:
346
346
  - - '='
347
347
  - !ruby/object:Gem::Version
348
348
  version: 1.0.1
349
+ - !ruby/object:Gem::Dependency
350
+ name: dry-monads
351
+ requirement: !ruby/object:Gem::Requirement
352
+ requirements:
353
+ - - '='
354
+ - !ruby/object:Gem::Version
355
+ version: 1.6.0
356
+ type: :runtime
357
+ prerelease: false
358
+ version_requirements: !ruby/object:Gem::Requirement
359
+ requirements:
360
+ - - '='
361
+ - !ruby/object:Gem::Version
362
+ version: 1.6.0
349
363
  - !ruby/object:Gem::Dependency
350
364
  name: dry-schema
351
365
  requirement: !ruby/object:Gem::Requirement
@@ -590,14 +604,14 @@ dependencies:
590
604
  requirements:
591
605
  - - '='
592
606
  - !ruby/object:Gem::Version
593
- version: 6.3.1
607
+ version: 6.4.0
594
608
  type: :runtime
595
609
  prerelease: false
596
610
  version_requirements: !ruby/object:Gem::Requirement
597
611
  requirements:
598
612
  - - '='
599
613
  - !ruby/object:Gem::Version
600
- version: 6.3.1
614
+ version: 6.4.0
601
615
  - !ruby/object:Gem::Dependency
602
616
  name: rack
603
617
  requirement: !ruby/object:Gem::Requirement
@@ -688,14 +702,14 @@ dependencies:
688
702
  requirements:
689
703
  - - '='
690
704
  - !ruby/object:Gem::Version
691
- version: 1.6.4
705
+ version: 1.6.6
692
706
  type: :runtime
693
707
  prerelease: false
694
708
  version_requirements: !ruby/object:Gem::Requirement
695
709
  requirements:
696
710
  - - '='
697
711
  - !ruby/object:Gem::Version
698
- version: 1.6.4
712
+ version: 1.6.6
699
713
  - !ruby/object:Gem::Dependency
700
714
  name: thor
701
715
  requirement: !ruby/object:Gem::Requirement
@@ -967,10 +981,13 @@ files:
967
981
  - lib/mihari/schemas/enricher.rb
968
982
  - lib/mihari/schemas/macros.rb
969
983
  - lib/mihari/schemas/rule.rb
984
+ - lib/mihari/services/alert_builder.rb
970
985
  - lib/mihari/services/alert_proxy.rb
971
986
  - lib/mihari/services/alert_runner.rb
987
+ - lib/mihari/services/rule_builder.rb
972
988
  - lib/mihari/services/rule_proxy.rb
973
989
  - lib/mihari/services/rule_runner.rb
990
+ - lib/mihari/structs/binaryedge.rb
974
991
  - lib/mihari/structs/censys.rb
975
992
  - lib/mihari/structs/config.rb
976
993
  - lib/mihari/structs/filters.rb
@@ -997,7 +1014,7 @@ files:
997
1014
  - lib/mihari/web/middleware/connection_adapter.rb
998
1015
  - lib/mihari/web/middleware/error_notification_adapter.rb
999
1016
  - lib/mihari/web/public/assets/index-33165282.css
1000
- - lib/mihari/web/public/assets/index-4d7eda9f.js
1017
+ - lib/mihari/web/public/assets/index-ef33a6cd.js
1001
1018
  - lib/mihari/web/public/assets/mode-yaml-a21faa53.js
1002
1019
  - lib/mihari/web/public/favicon.ico
1003
1020
  - lib/mihari/web/public/index.html