mihari 4.3.0 → 4.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mihari/analyzers/binaryedge.rb +10 -1
  3. data/lib/mihari/analyzers/censys.rb +26 -1
  4. data/lib/mihari/analyzers/circl.rb +23 -1
  5. data/lib/mihari/analyzers/greynoise.rb +10 -1
  6. data/lib/mihari/analyzers/onyphe.rb +10 -1
  7. data/lib/mihari/analyzers/otx.rb +8 -2
  8. data/lib/mihari/analyzers/passivetotal.rb +25 -3
  9. data/lib/mihari/analyzers/pulsedive.rb +7 -1
  10. data/lib/mihari/analyzers/securitytrails.rb +7 -1
  11. data/lib/mihari/analyzers/shodan.rb +10 -1
  12. data/lib/mihari/analyzers/spyse.rb +10 -1
  13. data/lib/mihari/analyzers/urlscan.rb +6 -1
  14. data/lib/mihari/analyzers/virustotal.rb +7 -2
  15. data/lib/mihari/analyzers/virustotal_intelligence.rb +6 -1
  16. data/lib/mihari/analyzers/zoomeye.rb +16 -2
  17. data/lib/mihari/cli/main.rb +2 -0
  18. data/lib/mihari/commands/search.rb +14 -0
  19. data/lib/mihari/commands/version.rb +18 -0
  20. data/lib/mihari/database.rb +10 -2
  21. data/lib/mihari/emitters/misp.rb +14 -8
  22. data/lib/mihari/emitters/slack.rb +20 -28
  23. data/lib/mihari/emitters/the_hive.rb +18 -6
  24. data/lib/mihari/entities/rule.rb +1 -12
  25. data/lib/mihari/errors.rb +2 -0
  26. data/lib/mihari/mixins/configurable.rb +12 -1
  27. data/lib/mihari/mixins/rule.rb +16 -19
  28. data/lib/mihari/models/artifact.rb +7 -2
  29. data/lib/mihari/models/rule.rb +12 -3
  30. data/lib/mihari/schemas/analyzer.rb +89 -10
  31. data/lib/mihari/schemas/emitter.rb +35 -0
  32. data/lib/mihari/schemas/rule.rb +5 -62
  33. data/lib/mihari/structs/rule.rb +33 -5
  34. data/lib/mihari/types.rb +0 -25
  35. data/lib/mihari/version.rb +1 -1
  36. data/lib/mihari/web/endpoints/rules.rb +20 -3
  37. data/lib/mihari/web/public/index.html +1 -1
  38. data/lib/mihari/web/public/redoc-static.html +11 -11
  39. data/lib/mihari/web/public/static/css/app.de5845d8.css +1 -0
  40. data/lib/mihari/web/public/static/css/chunk-vendors.da2a7bfc.css +7 -0
  41. data/lib/mihari/web/public/static/js/app-legacy.f550d6ae.js +2 -0
  42. data/lib/mihari/web/public/static/js/app-legacy.f550d6ae.js.map +1 -0
  43. data/lib/mihari/web/public/static/js/app.40749592.js +2 -0
  44. data/lib/mihari/web/public/static/js/app.40749592.js.map +1 -0
  45. data/lib/mihari/web/public/static/js/chunk-vendors-legacy.d6b76c57.js +25 -0
  46. data/lib/mihari/web/public/static/js/chunk-vendors-legacy.d6b76c57.js.map +1 -0
  47. data/lib/mihari/web/public/static/js/chunk-vendors.3bdbaffb.js +31 -0
  48. data/lib/mihari/web/public/static/js/chunk-vendors.3bdbaffb.js.map +1 -0
  49. data/mihari.gemspec +2 -2
  50. data/sig/lib/mihari/analyzers/binaryedge.rbs +2 -0
  51. data/sig/lib/mihari/analyzers/censys.rbs +4 -0
  52. data/sig/lib/mihari/analyzers/circl.rbs +5 -1
  53. data/sig/lib/mihari/analyzers/onyphe.rbs +2 -0
  54. data/sig/lib/mihari/analyzers/otx.rbs +3 -1
  55. data/sig/lib/mihari/analyzers/passivetotal.rbs +5 -1
  56. data/sig/lib/mihari/analyzers/pulsedive.rbs +3 -1
  57. data/sig/lib/mihari/analyzers/securitytrails.rbs +3 -1
  58. data/sig/lib/mihari/analyzers/shodan.rbs +2 -0
  59. data/sig/lib/mihari/analyzers/spyse.rbs +3 -1
  60. data/sig/lib/mihari/analyzers/urlscan.rbs +2 -0
  61. data/sig/lib/mihari/analyzers/virustotal.rbs +3 -1
  62. data/sig/lib/mihari/analyzers/virustotal_intelligence.rbs +2 -0
  63. data/sig/lib/mihari/analyzers/zoomeye.rbs +3 -1
  64. data/sig/lib/mihari/emitters/misp.rbs +6 -0
  65. data/sig/lib/mihari/emitters/slack.rbs +8 -20
  66. data/sig/lib/mihari/emitters/the_hive.rbs +4 -0
  67. data/sig/lib/mihari/mixins/configurable.rbs +4 -0
  68. data/sig/lib/mihari/mixins/rule.rbs +2 -0
  69. data/sig/lib/mihari/models/rule.rbs +3 -0
  70. data/sig/lib/mihari/structs/rule.rbs +5 -1
  71. metadata +18 -6
data/mihari.gemspec CHANGED
@@ -39,8 +39,8 @@ 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.8"
43
- spec.add_development_dependency "steep", "~> 0.49"
42
+ spec.add_development_dependency "standard", "~> 1.9"
43
+ spec.add_development_dependency "steep", "~> 0.50"
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"
@@ -6,6 +6,8 @@ module Mihari
6
6
 
7
7
  attr_reader interval: ::Integer
8
8
 
9
+ attr_reader api_key: String?
10
+
9
11
  def artifacts: () -> (Array[String] | Array[Mihari::Artifact])
10
12
 
11
13
  private
@@ -5,6 +5,10 @@ module Mihari
5
5
 
6
6
  attr_reader interval: ::Integer
7
7
 
8
+ attr_reader id: String?
9
+
10
+ attr_reader secret: String?
11
+
8
12
  def artifacts: () -> (Array[String] | Array[Mihari::Artifact])
9
13
 
10
14
  private
@@ -5,7 +5,11 @@ module Mihari
5
5
 
6
6
  attr_reader query: String
7
7
 
8
- attr_reader type: String
8
+ attr_reader type: String?
9
+
10
+ attr_reader username: String?
11
+
12
+ attr_reader password: String?
9
13
 
10
14
  def initialize: (*untyped args, **untyped kwargs) -> void
11
15
 
@@ -5,6 +5,8 @@ module Mihari
5
5
 
6
6
  attr_reader interval: ::Integer
7
7
 
8
+ attr_reader api_key: String?
9
+
8
10
  def artifacts: () -> (Array[String] | Array[Mihari::Artifact])
9
11
 
10
12
  private
@@ -5,7 +5,9 @@ module Mihari
5
5
 
6
6
  attr_reader query: String
7
7
 
8
- attr_reader type: String
8
+ attr_reader type: String?
9
+
10
+ attr_reader api_key: String?
9
11
 
10
12
  def initialize: (*untyped args, **untyped kwargs) -> void
11
13
 
@@ -5,7 +5,11 @@ module Mihari
5
5
 
6
6
  attr_reader query: String
7
7
 
8
- attr_reader type: String
8
+ attr_reader type: String?
9
+
10
+ attr_reader username: String?
11
+
12
+ attr_reader api_key: String?
9
13
 
10
14
  def initialize: (*untyped args, **untyped kwargs) -> void
11
15
 
@@ -5,7 +5,9 @@ module Mihari
5
5
 
6
6
  attr_reader query: String
7
7
 
8
- attr_reader type: String
8
+ attr_reader type: String?
9
+
10
+ attr_reader api_key: String?
9
11
 
10
12
  def initialize: (*untyped args, **untyped kwargs) -> void
11
13
 
@@ -5,7 +5,9 @@ module Mihari
5
5
 
6
6
  attr_reader query: String
7
7
 
8
- attr_reader type: String
8
+ attr_reader type: String?
9
+
10
+ attr_reader api_key: String?
9
11
 
10
12
  def initialize: (*untyped args, **untyped kwargs) -> void
11
13
 
@@ -5,6 +5,8 @@ module Mihari
5
5
 
6
6
  attr_reader interval: ::Integer
7
7
 
8
+ attr_reader api_key: String?
9
+
8
10
  def artifacts: () -> (Array[String] | Array[Mihari::Artifact])
9
11
 
10
12
  private
@@ -3,7 +3,9 @@ module Mihari
3
3
  class Spyse < Base
4
4
  attr_reader query: String
5
5
 
6
- attr_reader type: String
6
+ attr_reader type: String?
7
+
8
+ attr_reader api_key: String?
7
9
 
8
10
  def artifacts: () -> (Array[String] | Array[Mihari::Artifact])
9
11
 
@@ -9,6 +9,8 @@ module Mihari
9
9
 
10
10
  attr_reader interval: ::Integer
11
11
 
12
+ attr_reader api_key: String?
13
+
12
14
  def initialize: (*untyped args, **untyped kwargs) -> void
13
15
 
14
16
  def artifacts: () -> (Array[String] | Array[Mihari::Artifact])
@@ -3,7 +3,9 @@ module Mihari
3
3
  class VirusTotal < Base
4
4
  attr_reader query: String
5
5
 
6
- attr_reader type: String
6
+ attr_reader type: String?
7
+
8
+ attr_reader api_key: String?
7
9
 
8
10
  include Mixins::Refang
9
11
 
@@ -5,6 +5,8 @@ module Mihari
5
5
 
6
6
  attr_reader interval: ::Integer
7
7
 
8
+ attr_reader api_key: String?
9
+
8
10
  def initialize: (*untyped args, **untyped kwargs) -> void
9
11
 
10
12
  def artifacts: () -> (Array[String] | Array[Mihari::Artifact])
@@ -3,10 +3,12 @@ module Mihari
3
3
  class ZoomEye < Base
4
4
  attr_reader query: String
5
5
 
6
- attr_reader type: String
6
+ attr_reader type: String?
7
7
 
8
8
  attr_reader interval: ::Integer
9
9
 
10
+ attr_reader api_key: String?
11
+
10
12
  def artifacts: () -> (Array[String] | Array[Mihari::Artifact])
11
13
 
12
14
  private
@@ -1,6 +1,12 @@
1
1
  module Mihari
2
2
  module Emitters
3
3
  class MISP < Base
4
+
5
+ attr_reader api_endpiont: String?
6
+
7
+ attr_reader api_key: String?
8
+
9
+
4
10
  def initialize: () -> void
5
11
 
6
12
  # @return [true, false]
@@ -39,33 +39,25 @@ module Mihari
39
39
  end
40
40
 
41
41
  class Slack < Base
42
- SLACK_WEBHOOK_URL_KEY: ::String
42
+ DEFAULT_CHANNEL: String
43
43
 
44
- SLACK_CHANNEL_KEY: ::String
44
+ DEFAULT_USERNAME: String
45
45
 
46
- DEFAULT_USERNAME: ::String
46
+ # @return [String, nil]
47
+ attr_reader webhook_url: String?
47
48
 
48
- #
49
- # Slack channel to post
50
- #
51
49
  # @return [String]
52
- #
53
- def slack_channel: () -> String
50
+ attr_reader channel: String
54
51
 
55
- #
56
- # Slack webhook URL
57
- #
58
52
  # @return [String]
59
- #
60
- def slack_webhook_url: () -> String
53
+ attr_reader username: String
61
54
 
62
55
  #
63
- # Check Slack webhook URL is set
56
+ # Check webhook URL is set
64
57
  #
65
58
  # @return [Boolean]
66
59
  #
67
- def slack_webhook_url?: () -> bool
68
-
60
+ def webhook_url?: () -> bool
69
61
 
70
62
  def notifier: () -> ::Slack::Notifier
71
63
 
@@ -76,10 +68,6 @@ module Mihari
76
68
  def to_text: (title: String title, description: String description, ?tags: Array[String] tags) -> String
77
69
 
78
70
  def emit: (title: String title, description: String description, artifacts: Array[Mihari::Artifact] artifacts, ?tags: Array[String] tags, **untyped _options) -> void
79
-
80
- private
81
-
82
- def configuration_keys: () -> ::Array["slack_webhook_url"]
83
71
  end
84
72
  end
85
73
  end
@@ -1,6 +1,10 @@
1
1
  module Mihari
2
2
  module Emitters
3
3
  class TheHive < Base
4
+ attr_reader api_endpiont: String?
5
+
6
+ attr_reader api_key: String?
7
+
4
8
  # @return [true, false]
5
9
  def valid?: () -> bool
6
10
 
@@ -8,6 +8,8 @@ module Mihari
8
8
  #
9
9
  def configured?: () -> bool
10
10
 
11
+ private
12
+
11
13
  #
12
14
  # Configuration values
13
15
  #
@@ -21,6 +23,8 @@ module Mihari
21
23
  # @return [Array<String>] A list of cofiguration keys
22
24
  #
23
25
  def configuration_keys: () -> Array[String]
26
+
27
+ def api_key?: () -> bool
24
28
  end
25
29
  end
26
30
  end
@@ -1,6 +1,8 @@
1
1
  module Mihari
2
2
  module Mixins
3
3
  module Rule
4
+ def load_erb_yaml: (String yaml) -> Hash
5
+
4
6
  #
5
7
  # Load rule into hash
6
8
  #
@@ -4,6 +4,9 @@ module Mihari
4
4
  attr_accessor title(): String
5
5
  attr_accessor description(): String
6
6
  attr_accessor data(): Hash
7
+ attr_accessor yaml(): String?
8
+
9
+ def symbolized_data: () -> Hash
7
10
 
8
11
  def to_h: () -> Hash
9
12
 
@@ -11,7 +11,9 @@ module Mihari
11
11
  class Rule
12
12
  attr_reader data: Hash
13
13
 
14
- attr_reader errors: Array[untypes]
14
+ attr_reader yaml: String
15
+
16
+ attr_reader errors: Array[untypes]?
15
17
 
16
18
  def initialize: (Hash data) -> void
17
19
 
@@ -54,6 +56,8 @@ module Mihari
54
56
  def to_analyzer: () -> Mihari::Analyzers::Rule
55
57
 
56
58
  def self.from_model: (Mihari::Rule model) -> Mihari::Structs::Rule::Rule
59
+
60
+ def self.from_yaml: (String yaml) -> Mihari::Structs::Rule::Rule
57
61
  end
58
62
  end
59
63
  end
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.3.0
4
+ version: 4.4.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-03-20 00:00:00.000000000 Z
11
+ date: 2022-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -184,28 +184,28 @@ dependencies:
184
184
  requirements:
185
185
  - - "~>"
186
186
  - !ruby/object:Gem::Version
187
- version: '1.8'
187
+ version: '1.9'
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.8'
194
+ version: '1.9'
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: steep
197
197
  requirement: !ruby/object:Gem::Requirement
198
198
  requirements:
199
199
  - - "~>"
200
200
  - !ruby/object:Gem::Version
201
- version: '0.49'
201
+ version: '0.50'
202
202
  type: :development
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
206
  - - "~>"
207
207
  - !ruby/object:Gem::Version
208
- version: '0.49'
208
+ version: '0.50'
209
209
  - !ruby/object:Gem::Dependency
210
210
  name: timecop
211
211
  requirement: !ruby/object:Gem::Requirement
@@ -1126,6 +1126,7 @@ files:
1126
1126
  - lib/mihari/commands/init.rb
1127
1127
  - lib/mihari/commands/search.rb
1128
1128
  - lib/mihari/commands/validator.rb
1129
+ - lib/mihari/commands/version.rb
1129
1130
  - lib/mihari/commands/web.rb
1130
1131
  - lib/mihari/constants.rb
1131
1132
  - lib/mihari/database.rb
@@ -1175,6 +1176,7 @@ files:
1175
1176
  - lib/mihari/models/tagging.rb
1176
1177
  - lib/mihari/models/whois.rb
1177
1178
  - lib/mihari/schemas/analyzer.rb
1179
+ - lib/mihari/schemas/emitter.rb
1178
1180
  - lib/mihari/schemas/macros.rb
1179
1181
  - lib/mihari/schemas/rule.rb
1180
1182
  - lib/mihari/status.rb
@@ -1207,8 +1209,10 @@ files:
1207
1209
  - lib/mihari/web/public/redoc-static.html
1208
1210
  - lib/mihari/web/public/static/css/app.0de4b715.css
1209
1211
  - lib/mihari/web/public/static/css/app.43138058.css
1212
+ - lib/mihari/web/public/static/css/app.de5845d8.css
1210
1213
  - lib/mihari/web/public/static/css/chunk-vendors.3ed9b08e.css
1211
1214
  - lib/mihari/web/public/static/css/chunk-vendors.c57bb3fd.css
1215
+ - lib/mihari/web/public/static/css/chunk-vendors.da2a7bfc.css
1212
1216
  - lib/mihari/web/public/static/favicon.ico
1213
1217
  - lib/mihari/web/public/static/fonts/fa-brands-400.099a9556.woff
1214
1218
  - lib/mihari/web/public/static/fonts/fa-brands-400.1a575a41.woff
@@ -1258,6 +1262,8 @@ files:
1258
1262
  - lib/mihari/web/public/static/js/app-legacy.46b666f0.js.map
1259
1263
  - lib/mihari/web/public/static/js/app-legacy.e451304b.js
1260
1264
  - lib/mihari/web/public/static/js/app-legacy.e451304b.js.map
1265
+ - lib/mihari/web/public/static/js/app-legacy.f550d6ae.js
1266
+ - lib/mihari/web/public/static/js/app-legacy.f550d6ae.js.map
1261
1267
  - lib/mihari/web/public/static/js/app.06d5cf1c.js
1262
1268
  - lib/mihari/web/public/static/js/app.06d5cf1c.js.map
1263
1269
  - lib/mihari/web/public/static/js/app.0a0cc502.js
@@ -1268,6 +1274,8 @@ files:
1268
1274
  - lib/mihari/web/public/static/js/app.365f1907.js.map
1269
1275
  - lib/mihari/web/public/static/js/app.378da3dc.js
1270
1276
  - lib/mihari/web/public/static/js/app.378da3dc.js.map
1277
+ - lib/mihari/web/public/static/js/app.40749592.js
1278
+ - lib/mihari/web/public/static/js/app.40749592.js.map
1271
1279
  - lib/mihari/web/public/static/js/app.4818aedd.js
1272
1280
  - lib/mihari/web/public/static/js/app.4818aedd.js.map
1273
1281
  - lib/mihari/web/public/static/js/app.49ab738a.js
@@ -1302,8 +1310,12 @@ files:
1302
1310
  - lib/mihari/web/public/static/js/chunk-vendors-legacy.41357cdf.js.map
1303
1311
  - lib/mihari/web/public/static/js/chunk-vendors-legacy.c99e452e.js
1304
1312
  - lib/mihari/web/public/static/js/chunk-vendors-legacy.c99e452e.js.map
1313
+ - lib/mihari/web/public/static/js/chunk-vendors-legacy.d6b76c57.js
1314
+ - lib/mihari/web/public/static/js/chunk-vendors-legacy.d6b76c57.js.map
1305
1315
  - lib/mihari/web/public/static/js/chunk-vendors.15e84e22.js
1306
1316
  - lib/mihari/web/public/static/js/chunk-vendors.15e84e22.js.map
1317
+ - lib/mihari/web/public/static/js/chunk-vendors.3bdbaffb.js
1318
+ - lib/mihari/web/public/static/js/chunk-vendors.3bdbaffb.js.map
1307
1319
  - lib/mihari/web/public/static/js/chunk-vendors.c5525f1e.js
1308
1320
  - lib/mihari/web/public/static/js/chunk-vendors.c5525f1e.js.map
1309
1321
  - mihari.gemspec