mihari 4.5.1 → 4.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mihari/analyzers/rule.rb +6 -3
  3. data/lib/mihari/emitters/the_hive.rb +69 -10
  4. data/lib/mihari/emitters/webhook.rb +1 -1
  5. data/lib/mihari/schemas/emitter.rb +1 -0
  6. data/lib/mihari/structs/rule.rb +3 -0
  7. data/lib/mihari/version.rb +1 -1
  8. data/lib/mihari/web/endpoints/rules.rb +2 -1
  9. data/lib/mihari/web/public/index.html +1 -1
  10. data/lib/mihari/web/public/redoc-static.html +317 -314
  11. data/lib/mihari/web/public/static/css/{chunk-vendors.da2a7bfc.css → chunk-vendors.06251949.css} +2 -2
  12. data/lib/mihari/web/public/static/fonts/{fa-brands-400.f7223235.ttf → fa-brands-400.7fa789ab.ttf} +0 -0
  13. data/lib/mihari/web/public/static/fonts/fa-brands-400.859fc388.woff2 +0 -0
  14. data/lib/mihari/web/public/static/fonts/fa-regular-400.2ffd018f.woff2 +0 -0
  15. data/lib/mihari/web/public/static/fonts/{fa-regular-400.a7fde52b.ttf → fa-regular-400.da02cb7e.ttf} +0 -0
  16. data/lib/mihari/web/public/static/fonts/{fa-solid-900.5b03221c.ttf → fa-solid-900.3a463ec3.ttf} +0 -0
  17. data/lib/mihari/web/public/static/fonts/fa-solid-900.40ddefd7.woff2 +0 -0
  18. data/lib/mihari/web/public/static/fonts/{fa-v4compatibility.42932bea.ttf → fa-v4compatibility.924588dc.ttf} +0 -0
  19. data/lib/mihari/web/public/static/js/app-legacy.9d5c9c3d.js +2 -0
  20. data/lib/mihari/web/public/static/js/app-legacy.9d5c9c3d.js.map +1 -0
  21. data/lib/mihari/web/public/static/js/app.823b5af7.js +2 -0
  22. data/lib/mihari/web/public/static/js/app.823b5af7.js.map +1 -0
  23. data/lib/mihari/web/public/static/js/chunk-vendors-legacy.b110c129.js +25 -0
  24. data/lib/mihari/web/public/static/js/chunk-vendors-legacy.b110c129.js.map +1 -0
  25. data/lib/mihari/web/public/static/js/chunk-vendors.dde2116c.js +31 -0
  26. data/lib/mihari/web/public/static/js/chunk-vendors.dde2116c.js.map +1 -0
  27. data/lib/mihari.rb +49 -28
  28. data/mihari.gemspec +7 -8
  29. data/sig/lib/mihari/emitters/the_hive.rbs +4 -0
  30. data/sig/lib/mihari.rbs +1 -0
  31. metadata +32 -46
  32. data/lib/mihari/web/public/static/fonts/fa-brands-400.edf40f86.woff2 +0 -0
  33. data/lib/mihari/web/public/static/fonts/fa-regular-400.3665ebc7.woff2 +0 -0
  34. data/lib/mihari/web/public/static/fonts/fa-solid-900.0d2abd43.woff2 +0 -0
  35. data/lib/mihari/web/public/static/js/app-legacy.c3595dce.js +0 -2
  36. data/lib/mihari/web/public/static/js/app-legacy.c3595dce.js.map +0 -1
  37. data/lib/mihari/web/public/static/js/app.afd5025f.js +0 -2
  38. data/lib/mihari/web/public/static/js/app.afd5025f.js.map +0 -1
  39. data/lib/mihari/web/public/static/js/chunk-vendors-legacy.d6b76c57.js +0 -25
  40. data/lib/mihari/web/public/static/js/chunk-vendors-legacy.d6b76c57.js.map +0 -1
  41. data/lib/mihari/web/public/static/js/chunk-vendors.3bdbaffb.js +0 -31
  42. data/lib/mihari/web/public/static/js/chunk-vendors.3bdbaffb.js.map +0 -1
data/lib/mihari.rb CHANGED
@@ -71,34 +71,55 @@ end
71
71
  module Mihari
72
72
  extend Dry::Configurable
73
73
 
74
- setting :binaryedge_api_key, default: ENV["BINARYEDGE_API_KEY"]
75
- setting :censys_id, default: ENV["CENSYS_ID"]
76
- setting :censys_secret, default: ENV["CENSYS_SECRET"]
77
- setting :circl_passive_password, default: ENV["CIRCL_PASSIVE_PASSWORD"]
78
- setting :circl_passive_username, default: ENV["CIRCL_PASSIVE_USERNAME"]
79
- setting :database, default: ENV["DATABASE"] || "mihari.db"
80
- setting :greynoise_api_key, default: ENV["GREYNOISE_API_KEY"]
81
- setting :ipinfo_api_key, default: ENV["IPINFO_API_KEY"]
82
- setting :misp_api_endpoint, default: ENV["MISP_API_ENDPOINT"]
83
- setting :misp_api_key, default: ENV["MISP_API_KEY"]
84
- setting :onyphe_api_key, default: ENV["ONYPHE_API_KEY"]
85
- setting :otx_api_key, default: ENV["OTX_API_KEY"]
86
- setting :passivetotal_api_key, default: ENV["PASSIVETOTAL_API_KEY"]
87
- setting :passivetotal_username, default: ENV["PASSIVETOTAL_USERNAME"]
88
- setting :pulsedive_api_key, default: ENV["PULSEDIVE_API_KEY"]
89
- setting :securitytrails_api_key, default: ENV["SECURITYTRAILS_API_KEY"]
90
- setting :shodan_api_key, default: ENV["SHODAN_API_KEY"]
91
- setting :slack_channel, default: ENV["SLACK_CHANNEL"]
92
- setting :slack_webhook_url, default: ENV["SLACK_WEBHOOK_URL"]
93
- setting :spyse_api_key, default: ENV["SPYSE_API_KEY"]
94
- setting :thehive_api_endpoint, default: ENV["THEHIVE_API_ENDPOINT"]
95
- setting :thehive_api_key, default: ENV["THEHIVE_API_KEY"]
96
- setting :urlscan_api_key, default: ENV["URLSCAN_API_KEY"]
97
- setting :virustotal_api_key, default: ENV["VIRUSTOTAL_API_KEY"]
98
- setting :webhook_url, default: ENV["WEBHOOK_URL"]
99
- setting :webhook_use_json_body, constructor: ->(value = ENV["WEBHOOK_USE_JSON_BODY"]) { truthy?(value) }
100
- setting :zoomeye_api_key, default: ENV["ZOOMEYE_API_KEY"]
101
- setting :sentry_dsn, default: ENV["SENTRY_DSN"]
74
+ setting :binaryedge_api_key, default: ENV.fetch("BINARYEDGE_API_KEY", nil)
75
+
76
+ setting :censys_id, default: ENV.fetch("CENSYS_ID", nil)
77
+ setting :censys_secret, default: ENV.fetch("CENSYS_SECRET", nil)
78
+
79
+ setting :circl_passive_password, default: ENV.fetch("CIRCL_PASSIVE_PASSWORD", nil)
80
+ setting :circl_passive_username, default: ENV.fetch("CIRCL_PASSIVE_USERNAME", nil)
81
+
82
+ setting :database, default: ENV.fetch("DATABASE", "mihari.db")
83
+
84
+ setting :greynoise_api_key, default: ENV.fetch("GREYNOISE_API_KEY", nil)
85
+
86
+ setting :ipinfo_api_key, default: ENV.fetch("IPINFO_API_KEY", nil)
87
+
88
+ setting :misp_api_endpoint, default: ENV.fetch("MISP_API_ENDPOINT", nil)
89
+ setting :misp_api_key, default: ENV.fetch("MISP_API_KEY", nil)
90
+
91
+ setting :onyphe_api_key, default: ENV.fetch("ONYPHE_API_KEY", nil)
92
+
93
+ setting :otx_api_key, default: ENV.fetch("OTX_API_KEY", nil)
94
+
95
+ setting :passivetotal_api_key, default: ENV.fetch("PASSIVETOTAL_API_KEY", nil)
96
+ setting :passivetotal_username, default: ENV.fetch("PASSIVETOTAL_USERNAME", nil)
97
+
98
+ setting :pulsedive_api_key, default: ENV.fetch("PULSEDIVE_API_KEY", nil)
99
+
100
+ setting :securitytrails_api_key, default: ENV.fetch("SECURITYTRAILS_API_KEY", nil)
101
+
102
+ setting :shodan_api_key, default: ENV.fetch("SHODAN_API_KEY", nil)
103
+
104
+ setting :slack_channel, default: ENV.fetch("SLACK_CHANNEL", nil)
105
+ setting :slack_webhook_url, default: ENV.fetch("SLACK_WEBHOOK_URL", nil)
106
+
107
+ setting :spyse_api_key, default: ENV.fetch("SPYSE_API_KEY", nil)
108
+
109
+ setting :thehive_api_endpoint, default: ENV.fetch("THEHIVE_API_ENDPOINT", nil)
110
+ setting :thehive_api_key, default: ENV.fetch("THEHIVE_API_KEY", nil)
111
+ setting :thehive_api_version, default: ENV.fetch("THEHIVE_API_VERSION", nil)
112
+
113
+ setting :urlscan_api_key, default: ENV.fetch("URLSCAN_API_KEY", nil)
114
+
115
+ setting :virustotal_api_key, default: ENV.fetch("VIRUSTOTAL_API_KEY", nil)
116
+
117
+ setting :webhook_url, default: ENV.fetch("WEBHOOK_URL", nil)
118
+ setting :webhook_use_json_body, constructor: ->(value = ENV.fetch("WEBHOOK_USE_JSON_BODY", nil)) { truthy?(value) }
119
+
120
+ setting :zoomeye_api_key, default: ENV.fetch("ZOOMEYE_API_KEY", nil)
121
+
122
+ setting :sentry_dsn, default: ENV.fetch("SENTRY_DSN", nil)
102
123
 
103
124
  class << self
104
125
  include Memist::Memoizable
data/mihari.gemspec CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.add_development_dependency "coveralls_reborn", "~> 0.24"
32
32
  spec.add_development_dependency "fakefs", "~> 1.4"
33
33
  spec.add_development_dependency "mysql2", "~> 0.5"
34
- spec.add_development_dependency "overcommit", "~> 0.58"
34
+ spec.add_development_dependency "overcommit", "~> 0.59"
35
35
  spec.add_development_dependency "pg", "~> 1.3"
36
36
  spec.add_development_dependency "rack-test", "~> 1.1"
37
37
  spec.add_development_dependency "rake", "~> 13.0"
@@ -39,13 +39,13 @@ Gem::Specification.new do |spec|
39
39
  spec.add_development_dependency "rerun", "~> 0.13"
40
40
  spec.add_development_dependency "rspec", "~> 3.11"
41
41
  spec.add_development_dependency "simplecov-lcov", "~> 0.8.0"
42
- spec.add_development_dependency "standard", "~> 1.10"
42
+ spec.add_development_dependency "standard", "~> 1.12"
43
43
  spec.add_development_dependency "steep", "~> 0.52"
44
44
  spec.add_development_dependency "timecop", "~> 0.9"
45
45
  spec.add_development_dependency "vcr", "~> 6.1"
46
46
  spec.add_development_dependency "webmock", "~> 3.14"
47
47
 
48
- spec.add_dependency "activerecord", "7.0.2.3"
48
+ spec.add_dependency "activerecord", "7.0.3"
49
49
  spec.add_dependency "addressable", "2.8.0"
50
50
  spec.add_dependency "awrence", "2.0.1"
51
51
  spec.add_dependency "binaryedge", "0.1.0"
@@ -61,13 +61,13 @@ Gem::Specification.new do |spec|
61
61
  spec.add_dependency "dry-schema", "1.9.1"
62
62
  spec.add_dependency "dry-struct", "1.4.0"
63
63
  spec.add_dependency "dry-validation", "1.8.0"
64
- spec.add_dependency "email_address", "0.2.2"
64
+ spec.add_dependency "email_address", "0.2.3"
65
65
  spec.add_dependency "grape", "1.6.2"
66
66
  spec.add_dependency "grape-entity", "0.10.1"
67
67
  spec.add_dependency "grape-swagger", "1.4.2"
68
68
  spec.add_dependency "grape-swagger-entity", "0.5.1"
69
69
  spec.add_dependency "greynoise", "0.1.1"
70
- spec.add_dependency "hachi", "1.0.0"
70
+ spec.add_dependency "hachi", "2.0.0"
71
71
  spec.add_dependency "insensitive_hash", "0.3.3"
72
72
  spec.add_dependency "jr-cli", "0.5.1"
73
73
  spec.add_dependency "launchy", "2.5.0"
@@ -88,14 +88,13 @@ Gem::Specification.new do |spec|
88
88
  spec.add_dependency "rack-contrib", "2.3.0"
89
89
  spec.add_dependency "rack-cors", "1.1.1"
90
90
  spec.add_dependency "securitytrails", "1.0.0"
91
- spec.add_dependency "semantic_logger", "4.10.0"
92
- spec.add_dependency "sentry-ruby", "5.2.1"
91
+ spec.add_dependency "semantic_logger", "4.11.0"
92
+ spec.add_dependency "sentry-ruby", "5.3.0"
93
93
  spec.add_dependency "shodanx", "0.2.1"
94
94
  spec.add_dependency "slack-notifier", "2.4.0"
95
95
  spec.add_dependency "spysex", "0.2.0"
96
96
  spec.add_dependency "sqlite3", "1.4.2"
97
97
  spec.add_dependency "thor", "1.2.1"
98
- spec.add_dependency "thread_safe", "0.3.6"
99
98
  spec.add_dependency "urlscan", "0.8.0"
100
99
  spec.add_dependency "uuidtools", "2.2.0"
101
100
  spec.add_dependency "virustotalx", "1.2.0"
@@ -5,11 +5,15 @@ module Mihari
5
5
 
6
6
  attr_reader api_key: String?
7
7
 
8
+ attr_reader api_version: String?
9
+
8
10
  # @return [true, false]
9
11
  def valid?: () -> bool
10
12
 
11
13
  def emit: (title: untyped title, description: untyped description, artifacts: untyped artifacts, ?tags: untyped tags, **untyped _options) -> (nil | untyped)
12
14
 
15
+ def normalized_api_version: () -> String?
16
+
13
17
  private
14
18
 
15
19
  def configuration_keys: () -> ::Array["thehive_api_endpoint" | "thehive_api_key"]
data/sig/lib/mihari.rbs CHANGED
@@ -19,6 +19,7 @@ class Configuration
19
19
  attr_accessor spyse_api_key (): String?
20
20
  attr_accessor thehive_api_endpoint (): String?
21
21
  attr_accessor thehive_api_key (): String?
22
+ attr_accessor thehive_api_version (): String?
22
23
  attr_accessor urlscan_api_key (): String?
23
24
  attr_accessor virustotal_api_key (): String?
24
25
  attr_accessor zoomeye_api_key (): String?
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: 4.5.1
4
+ version: 4.6.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: 2022-04-22 00:00:00.000000000 Z
11
+ date: 2022-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0.58'
75
+ version: '0.59'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0.58'
82
+ version: '0.59'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: pg
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -184,14 +184,14 @@ dependencies:
184
184
  requirements:
185
185
  - - "~>"
186
186
  - !ruby/object:Gem::Version
187
- version: '1.10'
187
+ version: '1.12'
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.10'
194
+ version: '1.12'
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: steep
197
197
  requirement: !ruby/object:Gem::Requirement
@@ -254,14 +254,14 @@ dependencies:
254
254
  requirements:
255
255
  - - '='
256
256
  - !ruby/object:Gem::Version
257
- version: 7.0.2.3
257
+ version: 7.0.3
258
258
  type: :runtime
259
259
  prerelease: false
260
260
  version_requirements: !ruby/object:Gem::Requirement
261
261
  requirements:
262
262
  - - '='
263
263
  - !ruby/object:Gem::Version
264
- version: 7.0.2.3
264
+ version: 7.0.3
265
265
  - !ruby/object:Gem::Dependency
266
266
  name: addressable
267
267
  requirement: !ruby/object:Gem::Requirement
@@ -478,14 +478,14 @@ dependencies:
478
478
  requirements:
479
479
  - - '='
480
480
  - !ruby/object:Gem::Version
481
- version: 0.2.2
481
+ version: 0.2.3
482
482
  type: :runtime
483
483
  prerelease: false
484
484
  version_requirements: !ruby/object:Gem::Requirement
485
485
  requirements:
486
486
  - - '='
487
487
  - !ruby/object:Gem::Version
488
- version: 0.2.2
488
+ version: 0.2.3
489
489
  - !ruby/object:Gem::Dependency
490
490
  name: grape
491
491
  requirement: !ruby/object:Gem::Requirement
@@ -562,14 +562,14 @@ dependencies:
562
562
  requirements:
563
563
  - - '='
564
564
  - !ruby/object:Gem::Version
565
- version: 1.0.0
565
+ version: 2.0.0
566
566
  type: :runtime
567
567
  prerelease: false
568
568
  version_requirements: !ruby/object:Gem::Requirement
569
569
  requirements:
570
570
  - - '='
571
571
  - !ruby/object:Gem::Version
572
- version: 1.0.0
572
+ version: 2.0.0
573
573
  - !ruby/object:Gem::Dependency
574
574
  name: insensitive_hash
575
575
  requirement: !ruby/object:Gem::Requirement
@@ -856,28 +856,28 @@ dependencies:
856
856
  requirements:
857
857
  - - '='
858
858
  - !ruby/object:Gem::Version
859
- version: 4.10.0
859
+ version: 4.11.0
860
860
  type: :runtime
861
861
  prerelease: false
862
862
  version_requirements: !ruby/object:Gem::Requirement
863
863
  requirements:
864
864
  - - '='
865
865
  - !ruby/object:Gem::Version
866
- version: 4.10.0
866
+ version: 4.11.0
867
867
  - !ruby/object:Gem::Dependency
868
868
  name: sentry-ruby
869
869
  requirement: !ruby/object:Gem::Requirement
870
870
  requirements:
871
871
  - - '='
872
872
  - !ruby/object:Gem::Version
873
- version: 5.2.1
873
+ version: 5.3.0
874
874
  type: :runtime
875
875
  prerelease: false
876
876
  version_requirements: !ruby/object:Gem::Requirement
877
877
  requirements:
878
878
  - - '='
879
879
  - !ruby/object:Gem::Version
880
- version: 5.2.1
880
+ version: 5.3.0
881
881
  - !ruby/object:Gem::Dependency
882
882
  name: shodanx
883
883
  requirement: !ruby/object:Gem::Requirement
@@ -948,20 +948,6 @@ dependencies:
948
948
  - - '='
949
949
  - !ruby/object:Gem::Version
950
950
  version: 1.2.1
951
- - !ruby/object:Gem::Dependency
952
- name: thread_safe
953
- requirement: !ruby/object:Gem::Requirement
954
- requirements:
955
- - - '='
956
- - !ruby/object:Gem::Version
957
- version: 0.3.6
958
- type: :runtime
959
- prerelease: false
960
- version_requirements: !ruby/object:Gem::Requirement
961
- requirements:
962
- - - '='
963
- - !ruby/object:Gem::Version
964
- version: 0.3.6
965
951
  - !ruby/object:Gem::Dependency
966
952
  name: urlscan
967
953
  requirement: !ruby/object:Gem::Requirement
@@ -1197,23 +1183,23 @@ files:
1197
1183
  - lib/mihari/web/public/index.html
1198
1184
  - lib/mihari/web/public/redoc-static.html
1199
1185
  - lib/mihari/web/public/static/css/app.2a5d3d21.css
1200
- - lib/mihari/web/public/static/css/chunk-vendors.da2a7bfc.css
1186
+ - lib/mihari/web/public/static/css/chunk-vendors.06251949.css
1201
1187
  - lib/mihari/web/public/static/favicon.ico
1202
- - lib/mihari/web/public/static/fonts/fa-brands-400.edf40f86.woff2
1203
- - lib/mihari/web/public/static/fonts/fa-brands-400.f7223235.ttf
1204
- - lib/mihari/web/public/static/fonts/fa-regular-400.3665ebc7.woff2
1205
- - lib/mihari/web/public/static/fonts/fa-regular-400.a7fde52b.ttf
1206
- - lib/mihari/web/public/static/fonts/fa-solid-900.0d2abd43.woff2
1207
- - lib/mihari/web/public/static/fonts/fa-solid-900.5b03221c.ttf
1208
- - lib/mihari/web/public/static/fonts/fa-v4compatibility.42932bea.ttf
1209
- - lib/mihari/web/public/static/js/app-legacy.c3595dce.js
1210
- - lib/mihari/web/public/static/js/app-legacy.c3595dce.js.map
1211
- - lib/mihari/web/public/static/js/app.afd5025f.js
1212
- - lib/mihari/web/public/static/js/app.afd5025f.js.map
1213
- - lib/mihari/web/public/static/js/chunk-vendors-legacy.d6b76c57.js
1214
- - lib/mihari/web/public/static/js/chunk-vendors-legacy.d6b76c57.js.map
1215
- - lib/mihari/web/public/static/js/chunk-vendors.3bdbaffb.js
1216
- - lib/mihari/web/public/static/js/chunk-vendors.3bdbaffb.js.map
1188
+ - lib/mihari/web/public/static/fonts/fa-brands-400.7fa789ab.ttf
1189
+ - lib/mihari/web/public/static/fonts/fa-brands-400.859fc388.woff2
1190
+ - lib/mihari/web/public/static/fonts/fa-regular-400.2ffd018f.woff2
1191
+ - lib/mihari/web/public/static/fonts/fa-regular-400.da02cb7e.ttf
1192
+ - lib/mihari/web/public/static/fonts/fa-solid-900.3a463ec3.ttf
1193
+ - lib/mihari/web/public/static/fonts/fa-solid-900.40ddefd7.woff2
1194
+ - lib/mihari/web/public/static/fonts/fa-v4compatibility.924588dc.ttf
1195
+ - lib/mihari/web/public/static/js/app-legacy.9d5c9c3d.js
1196
+ - lib/mihari/web/public/static/js/app-legacy.9d5c9c3d.js.map
1197
+ - lib/mihari/web/public/static/js/app.823b5af7.js
1198
+ - lib/mihari/web/public/static/js/app.823b5af7.js.map
1199
+ - lib/mihari/web/public/static/js/chunk-vendors-legacy.b110c129.js
1200
+ - lib/mihari/web/public/static/js/chunk-vendors-legacy.b110c129.js.map
1201
+ - lib/mihari/web/public/static/js/chunk-vendors.dde2116c.js
1202
+ - lib/mihari/web/public/static/js/chunk-vendors.dde2116c.js.map
1217
1203
  - mihari.gemspec
1218
1204
  - renovate.json
1219
1205
  - sig/lib/mihari.rbs