mihari 3.9.1 → 3.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -0
  3. data/docker/Dockerfile +1 -1
  4. data/lib/mihari/analyzers/binaryedge.rb +5 -0
  5. data/lib/mihari/analyzers/censys.rb +5 -0
  6. data/lib/mihari/analyzers/greynoise.rb +65 -0
  7. data/lib/mihari/analyzers/onyphe.rb +5 -0
  8. data/lib/mihari/analyzers/rule.rb +7 -0
  9. data/lib/mihari/analyzers/shodan.rb +16 -5
  10. data/lib/mihari/analyzers/urlscan.rb +37 -13
  11. data/lib/mihari/analyzers/virustotal_intelligence.rb +5 -0
  12. data/lib/mihari/analyzers/zoomeye.rb +8 -0
  13. data/lib/mihari/cli/analyzer.rb +3 -0
  14. data/lib/mihari/commands/greynoise.rb +21 -0
  15. data/lib/mihari/commands/search.rb +3 -2
  16. data/lib/mihari/commands/urlscan.rb +1 -2
  17. data/lib/mihari/schemas/configuration.rb +3 -2
  18. data/lib/mihari/schemas/rule.rb +9 -1
  19. data/lib/mihari/structs/greynoise.rb +55 -0
  20. data/lib/mihari/structs/shodan.rb +6 -6
  21. data/lib/mihari/structs/urlscan.rb +51 -0
  22. data/lib/mihari/types.rb +4 -0
  23. data/lib/mihari/version.rb +1 -1
  24. data/lib/mihari/web/public/index.html +1 -1
  25. data/lib/mihari/web/public/redoc-static.html +1 -1
  26. data/lib/mihari/web/public/static/js/app.0a0cc502.js +21 -0
  27. data/lib/mihari/web/public/static/js/app.0a0cc502.js.map +1 -0
  28. data/lib/mihari/web/public/static/js/app.14008741.js +21 -0
  29. data/lib/mihari/web/public/static/js/app.14008741.js.map +1 -0
  30. data/lib/mihari/web/public/static/js/app.fbc19869.js +21 -0
  31. data/lib/mihari/web/public/static/js/app.fbc19869.js.map +1 -0
  32. data/lib/mihari.rb +6 -2
  33. data/mihari.gemspec +7 -5
  34. data/sig/lib/mihari/analyzers/binaryedge.rbs +2 -0
  35. data/sig/lib/mihari/analyzers/censys.rbs +2 -0
  36. data/sig/lib/mihari/analyzers/onyphe.rbs +2 -0
  37. data/sig/lib/mihari/analyzers/shodan.rbs +2 -0
  38. data/sig/lib/mihari/analyzers/urlscan.rbs +5 -2
  39. data/sig/lib/mihari/analyzers/virustotal_intelligence.rbs +2 -0
  40. data/sig/lib/mihari/analyzers/zoomeye.rbs +2 -0
  41. data/sig/lib/mihari/structs/greynoise.rbs +30 -0
  42. data/sig/lib/mihari/structs/shodan.rbs +3 -3
  43. data/sig/lib/mihari/structs/urlscan.rbs +28 -0
  44. metadata +52 -12
data/lib/mihari.rb CHANGED
@@ -37,6 +37,8 @@ module Mihari
37
37
  setting :censys_secret, default: ENV["CENSYS_SECRET"]
38
38
  setting :circl_passive_password, default: ENV["CIRCL_PASSIVE_PASSWORD"]
39
39
  setting :circl_passive_username, default: ENV["CIRCL_PASSIVE_USERNAME"]
40
+ setting :database, default: ENV["DATABASE"] || "mihari.db"
41
+ setting :greynoise_api_key, default: ENV["GREYNOISE_API_KEY"]
40
42
  setting :ipinfo_api_key, default: ENV["IPINFO_API_KEY"]
41
43
  setting :misp_api_endpoint, default: ENV["MISP_API_ENDPOINT"]
42
44
  setting :misp_api_key, default: ENV["MISP_API_KEY"]
@@ -54,10 +56,9 @@ module Mihari
54
56
  setting :thehive_api_key, default: ENV["THEHIVE_API_KEY"]
55
57
  setting :urlscan_api_key, default: ENV["URLSCAN_API_KEY"]
56
58
  setting :virustotal_api_key, default: ENV["VIRUSTOTAL_API_KEY"]
57
- setting :zoomeye_api_key, default: ENV["ZOOMEYE_API_KEY"]
58
59
  setting :webhook_url, default: ENV["WEBHOOK_URL"]
59
60
  setting :webhook_use_json_body, constructor: ->(value = ENV["WEBHOOK_USE_JSON_BODY"]) { truthy?(value) }
60
- setting :database, default: ENV["DATABASE"] || "mihari.db"
61
+ setting :zoomeye_api_key, default: ENV["ZOOMEYE_API_KEY"]
61
62
 
62
63
  class << self
63
64
  include Mem
@@ -112,9 +113,11 @@ require "mihari/types"
112
113
  # Structs
113
114
  require "mihari/structs/alert"
114
115
  require "mihari/structs/censys"
116
+ require "mihari/structs/greynoise"
115
117
  require "mihari/structs/ipinfo"
116
118
  require "mihari/structs/onyphe"
117
119
  require "mihari/structs/shodan"
120
+ require "mihari/structs/urlscan"
118
121
  require "mihari/structs/virustotal_intelligence"
119
122
 
120
123
  # Schemas
@@ -147,6 +150,7 @@ require "mihari/analyzers/circl"
147
150
  require "mihari/analyzers/crtsh"
148
151
  require "mihari/analyzers/dnpedia"
149
152
  require "mihari/analyzers/dnstwister"
153
+ require "mihari/analyzers/greynoise"
150
154
  require "mihari/analyzers/onyphe"
151
155
  require "mihari/analyzers/otx"
152
156
  require "mihari/analyzers/passivetotal"
data/mihari.gemspec CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
 
28
28
  spec.add_development_dependency "bundler", "~> 2.2"
29
29
  spec.add_development_dependency "coveralls_reborn", "~> 0.23"
30
- spec.add_development_dependency "fakefs", "~> 1.3"
30
+ spec.add_development_dependency "fakefs", "~> 1.4"
31
31
  spec.add_development_dependency "mysql2", "~> 0.5"
32
32
  spec.add_development_dependency "overcommit", "~> 0.58"
33
33
  spec.add_development_dependency "pg", "~> 1.2"
@@ -36,8 +36,8 @@ Gem::Specification.new do |spec|
36
36
  spec.add_development_dependency "rb-fsevent", "~> 0.11"
37
37
  spec.add_development_dependency "rerun", "~> 0.13"
38
38
  spec.add_development_dependency "rspec", "~> 3.10"
39
- spec.add_development_dependency "standard", "~> 1.3"
40
- spec.add_development_dependency "steep", "~> 0.46"
39
+ spec.add_development_dependency "standard", "~> 1.5"
40
+ spec.add_development_dependency "steep", "~> 0.47"
41
41
  spec.add_development_dependency "timecop", "~> 0.9"
42
42
  spec.add_development_dependency "vcr", "~> 6.0"
43
43
  spec.add_development_dependency "webmock", "~> 3.14"
@@ -55,15 +55,17 @@ Gem::Specification.new do |spec|
55
55
  spec.add_dependency "dnstwister", "~> 0.1"
56
56
  spec.add_dependency "dotenv", "~> 2.7"
57
57
  spec.add_dependency "dry-configurable", "~> 0.13"
58
+ spec.add_dependency "dry-container", "~> 0.9"
58
59
  spec.add_dependency "dry-files", "~> 0.1"
59
60
  spec.add_dependency "dry-initializer", "~> 3.0"
60
61
  spec.add_dependency "dry-struct", "~> 1.4"
61
62
  spec.add_dependency "dry-validation", "~> 1.7"
62
63
  spec.add_dependency "email_address", "~> 0.2"
63
- spec.add_dependency "grape", "~> 1.5"
64
+ spec.add_dependency "grape", "~> 1.6"
64
65
  spec.add_dependency "grape-entity", "~> 0.10"
65
66
  spec.add_dependency "grape-swagger", "~> 1.4"
66
67
  spec.add_dependency "grape-swagger-entity", "~> 0.5"
68
+ spec.add_dependency "greynoise", "~> 0.1"
67
69
  spec.add_dependency "hachi", "~> 1.0"
68
70
  spec.add_dependency "http", "~> 5.0"
69
71
  spec.add_dependency "launchy", "~> 2.5"
@@ -92,7 +94,7 @@ Gem::Specification.new do |spec|
92
94
  spec.add_dependency "sqlite3", "~> 1.4"
93
95
  spec.add_dependency "thor", "~> 1.1"
94
96
  spec.add_dependency "thread_safe", "~> 0.3"
95
- spec.add_dependency "urlscan", "~> 0.7"
97
+ spec.add_dependency "urlscan", "~> 0.8"
96
98
  spec.add_dependency "uuidtools", "~> 2.2"
97
99
  spec.add_dependency "virustotalx", "~> 1.2"
98
100
  spec.add_dependency "whois", "~> 5.0"
@@ -7,6 +7,8 @@ module Mihari
7
7
  attr_reader description: String
8
8
  attr_reader tags: Array[String]
9
9
 
10
+ attr_reader interval: ::Integer
11
+
10
12
  def artifacts: () -> (Array[String] | Array[Mihari::Artifact])
11
13
 
12
14
  private
@@ -6,6 +6,8 @@ module Mihari
6
6
  attr_reader description: String
7
7
  attr_reader tags: Array[String]
8
8
 
9
+ attr_reader interval: ::Integer
10
+
9
11
  def artifacts: () -> (Array[String] | Array[Mihari::Artifact])
10
12
 
11
13
  private
@@ -6,6 +6,8 @@ module Mihari
6
6
  attr_reader description: String
7
7
  attr_reader tags: Array[String]
8
8
 
9
+ attr_reader interval: ::Integer
10
+
9
11
  def artifacts: () -> (Array[String] | Array[Mihari::Artifact])
10
12
 
11
13
  private
@@ -6,6 +6,8 @@ module Mihari
6
6
  attr_reader description: String
7
7
  attr_reader tags: Array[String]
8
8
 
9
+ attr_reader interval: ::Integer
10
+
9
11
  def artifacts: () -> (Array[String] | Array[Mihari::Artifact])
10
12
 
11
13
  private
@@ -8,7 +8,8 @@ module Mihari
8
8
  attr_reader description: String
9
9
  attr_reader tags: Array[String]
10
10
  attr_reader allowed_data_types: Array[String]
11
- attr_reader use_similarity: bool
11
+
12
+ attr_reader interval: ::Integer
12
13
 
13
14
  def initialize: (*untyped args, **untyped kwargs) -> void
14
15
 
@@ -20,7 +21,9 @@ module Mihari
20
21
 
21
22
  def api: () -> untyped
22
23
 
23
- def search: () -> Array[Hash[(String | Symbol), untyped]]
24
+ def search_with_search_after: (search_after: String?) -> Array[Hash[(String | Symbol), untyped]]
25
+
26
+ def search: () -> Array[Mihari::Structs::Urlscan::Response]
24
27
 
25
28
  def valid_alllowed_data_types?: () -> bool
26
29
  end
@@ -6,6 +6,8 @@ module Mihari
6
6
  attr_reader description: String
7
7
  attr_reader tags: Array[String]
8
8
 
9
+ attr_reader interval: ::Integer
10
+
9
11
  def initialize: (*untyped args, **untyped kwargs) -> void
10
12
 
11
13
  def artifacts: () -> (Array[String] | Array[Mihari::Artifact])
@@ -7,6 +7,8 @@ module Mihari
7
7
  attr_reader tags: Array[String]
8
8
  attr_reader type: String
9
9
 
10
+ attr_reader interval: ::Integer
11
+
10
12
  def artifacts: () -> (Array[String] | Array[Mihari::Artifact])
11
13
 
12
14
  private
@@ -0,0 +1,30 @@
1
+ module Mihari
2
+ module Structs
3
+ module GreyNoise
4
+ class Metadata < Dry::Struct
5
+ attr_reader country: String
6
+ attr_reader country_code: String
7
+ attr_reader asn: String
8
+
9
+ def self.from_dynamic!: (Hash[(String | Symbol), untyped] d) -> Mihari::Structs::GreyNoise::Metadata
10
+ end
11
+
12
+ class Datum < Dry::Struct
13
+ attr_reader ip: String
14
+ attr_reader metadata: Mihari::Structs::GreyNoise::Metadata
15
+
16
+ def self.from_dynamic!: (Hash[(String | Symbol), untyped] d) -> Mihari::Structs::GreyNoise::Datum
17
+ end
18
+
19
+ class Response < Dry::Struct
20
+ attr_reader complete: Boolean
21
+ attr_reader count: Integer
22
+ attr_reader data: Array[Mihari::Structs::GreyNoise::Danum]
23
+ attr_reader message: String
24
+ attr_reader query: String
25
+
26
+ def self.from_dynamic!: (Hash[(String | Symbol), untyped] d) -> Mihari::Structs::GreyNoise::Response
27
+ end
28
+ end
29
+ end
30
+ end
@@ -2,14 +2,14 @@ module Mihari
2
2
  module Structs
3
3
  module Shodan
4
4
  class Location
5
- attr_reader country_code: String
6
- attr_reader country_name: String
5
+ attr_reader country_code: String?
6
+ attr_reader country_name: String?
7
7
 
8
8
  def self.from_dynamic!: (Hash[(String | Symbol), untyped] d) -> Mihari::Structs::Shodan::Location
9
9
  end
10
10
 
11
11
  class Match
12
- attr_reader asn: String
12
+ attr_reader asn: String?
13
13
  attr_reader hostnames: Array[String]
14
14
  attr_reader location: Mihari::Structs::Shodan::Location
15
15
  attr_reader domains: Array[String]
@@ -0,0 +1,28 @@
1
+ module Mihari
2
+ module Structs
3
+ module Urlscan
4
+ class Page < Dry::Struct
5
+ attr_reader domain: String?
6
+ attr_reader ip: String?
7
+ attr_reader url: String
8
+
9
+ def self.from_dynamic!: (Hash[(String | Symbol), untyped] d) -> Mihari::Structs::Urlscan::Page
10
+ end
11
+
12
+ class Result < Dry::Struct
13
+ attr_reader page: Mihari::Structs::Urlscan::Page
14
+ attr_reader id: String
15
+ attr_reader sort: Array[Integer | String]
16
+
17
+ def self.from_dynamic!: (Hash[(String | Symbol), untyped] d) -> Mihari::Structs::Urlscan::Result
18
+ end
19
+
20
+ class Response < Dry::Struct
21
+ attr_reader results: Array[Mihari::Structs::Urlscan::Result]
22
+ attr_reader has_more: Boolean
23
+
24
+ def self.from_dynamic!: (Hash[(String | Symbol), untyped] d) -> Mihari::Structs::Urlscan::Response
25
+ end
26
+ end
27
+ end
28
+ 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: 3.9.1
4
+ version: 3.11.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: 2021-09-28 00:00:00.000000000 Z
11
+ date: 2021-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.3'
47
+ version: '1.4'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '1.3'
54
+ version: '1.4'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: mysql2
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -170,28 +170,28 @@ dependencies:
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: '1.3'
173
+ version: '1.5'
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: '1.3'
180
+ version: '1.5'
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: steep
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
185
  - - "~>"
186
186
  - !ruby/object:Gem::Version
187
- version: '0.46'
187
+ version: '0.47'
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: '0.46'
194
+ version: '0.47'
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: timecop
197
197
  requirement: !ruby/object:Gem::Requirement
@@ -416,6 +416,20 @@ dependencies:
416
416
  - - "~>"
417
417
  - !ruby/object:Gem::Version
418
418
  version: '0.13'
419
+ - !ruby/object:Gem::Dependency
420
+ name: dry-container
421
+ requirement: !ruby/object:Gem::Requirement
422
+ requirements:
423
+ - - "~>"
424
+ - !ruby/object:Gem::Version
425
+ version: '0.9'
426
+ type: :runtime
427
+ prerelease: false
428
+ version_requirements: !ruby/object:Gem::Requirement
429
+ requirements:
430
+ - - "~>"
431
+ - !ruby/object:Gem::Version
432
+ version: '0.9'
419
433
  - !ruby/object:Gem::Dependency
420
434
  name: dry-files
421
435
  requirement: !ruby/object:Gem::Requirement
@@ -492,14 +506,14 @@ dependencies:
492
506
  requirements:
493
507
  - - "~>"
494
508
  - !ruby/object:Gem::Version
495
- version: '1.5'
509
+ version: '1.6'
496
510
  type: :runtime
497
511
  prerelease: false
498
512
  version_requirements: !ruby/object:Gem::Requirement
499
513
  requirements:
500
514
  - - "~>"
501
515
  - !ruby/object:Gem::Version
502
- version: '1.5'
516
+ version: '1.6'
503
517
  - !ruby/object:Gem::Dependency
504
518
  name: grape-entity
505
519
  requirement: !ruby/object:Gem::Requirement
@@ -542,6 +556,20 @@ dependencies:
542
556
  - - "~>"
543
557
  - !ruby/object:Gem::Version
544
558
  version: '0.5'
559
+ - !ruby/object:Gem::Dependency
560
+ name: greynoise
561
+ requirement: !ruby/object:Gem::Requirement
562
+ requirements:
563
+ - - "~>"
564
+ - !ruby/object:Gem::Version
565
+ version: '0.1'
566
+ type: :runtime
567
+ prerelease: false
568
+ version_requirements: !ruby/object:Gem::Requirement
569
+ requirements:
570
+ - - "~>"
571
+ - !ruby/object:Gem::Version
572
+ version: '0.1'
545
573
  - !ruby/object:Gem::Dependency
546
574
  name: hachi
547
575
  requirement: !ruby/object:Gem::Requirement
@@ -940,14 +968,14 @@ dependencies:
940
968
  requirements:
941
969
  - - "~>"
942
970
  - !ruby/object:Gem::Version
943
- version: '0.7'
971
+ version: '0.8'
944
972
  type: :runtime
945
973
  prerelease: false
946
974
  version_requirements: !ruby/object:Gem::Requirement
947
975
  requirements:
948
976
  - - "~>"
949
977
  - !ruby/object:Gem::Version
950
- version: '0.7'
978
+ version: '0.8'
951
979
  - !ruby/object:Gem::Dependency
952
980
  name: uuidtools
953
981
  requirement: !ruby/object:Gem::Requirement
@@ -1064,6 +1092,7 @@ files:
1064
1092
  - lib/mihari/analyzers/crtsh.rb
1065
1093
  - lib/mihari/analyzers/dnpedia.rb
1066
1094
  - lib/mihari/analyzers/dnstwister.rb
1095
+ - lib/mihari/analyzers/greynoise.rb
1067
1096
  - lib/mihari/analyzers/onyphe.rb
1068
1097
  - lib/mihari/analyzers/otx.rb
1069
1098
  - lib/mihari/analyzers/passivetotal.rb
@@ -1088,6 +1117,7 @@ files:
1088
1117
  - lib/mihari/commands/crtsh.rb
1089
1118
  - lib/mihari/commands/dnpedia.rb
1090
1119
  - lib/mihari/commands/dnstwister.rb
1120
+ - lib/mihari/commands/greynoise.rb
1091
1121
  - lib/mihari/commands/init.rb
1092
1122
  - lib/mihari/commands/json.rb
1093
1123
  - lib/mihari/commands/onyphe.rb
@@ -1143,9 +1173,11 @@ files:
1143
1173
  - lib/mihari/status.rb
1144
1174
  - lib/mihari/structs/alert.rb
1145
1175
  - lib/mihari/structs/censys.rb
1176
+ - lib/mihari/structs/greynoise.rb
1146
1177
  - lib/mihari/structs/ipinfo.rb
1147
1178
  - lib/mihari/structs/onyphe.rb
1148
1179
  - lib/mihari/structs/shodan.rb
1180
+ - lib/mihari/structs/urlscan.rb
1149
1181
  - lib/mihari/structs/virustotal_intelligence.rb
1150
1182
  - lib/mihari/templates/rule.yml.erb
1151
1183
  - lib/mihari/type_checker.rb
@@ -1209,6 +1241,10 @@ files:
1209
1241
  - lib/mihari/web/public/static/img/fa-solid-900.37bc7099.svg
1210
1242
  - lib/mihari/web/public/static/js/app.06d5cf1c.js
1211
1243
  - lib/mihari/web/public/static/js/app.06d5cf1c.js.map
1244
+ - lib/mihari/web/public/static/js/app.0a0cc502.js
1245
+ - lib/mihari/web/public/static/js/app.0a0cc502.js.map
1246
+ - lib/mihari/web/public/static/js/app.14008741.js
1247
+ - lib/mihari/web/public/static/js/app.14008741.js.map
1212
1248
  - lib/mihari/web/public/static/js/app.365f1907.js
1213
1249
  - lib/mihari/web/public/static/js/app.365f1907.js.map
1214
1250
  - lib/mihari/web/public/static/js/app.378da3dc.js
@@ -1225,6 +1261,8 @@ files:
1225
1261
  - lib/mihari/web/public/static/js/app.b5914c39.js.map
1226
1262
  - lib/mihari/web/public/static/js/app.cccddb2b.js
1227
1263
  - lib/mihari/web/public/static/js/app.cccddb2b.js.map
1264
+ - lib/mihari/web/public/static/js/app.fbc19869.js
1265
+ - lib/mihari/web/public/static/js/app.fbc19869.js.map
1228
1266
  - mihari.gemspec
1229
1267
  - renovate.json
1230
1268
  - sig/lib/mihari.rbs
@@ -1310,9 +1348,11 @@ files:
1310
1348
  - sig/lib/mihari/status.rbs
1311
1349
  - sig/lib/mihari/structs/alert.rbs
1312
1350
  - sig/lib/mihari/structs/censys.rbs
1351
+ - sig/lib/mihari/structs/greynoise.rbs
1313
1352
  - sig/lib/mihari/structs/ipinfo.rbs
1314
1353
  - sig/lib/mihari/structs/onyphe.rbs
1315
1354
  - sig/lib/mihari/structs/shodan.rbs
1355
+ - sig/lib/mihari/structs/urlscan.rbs
1316
1356
  - sig/lib/mihari/structs/virustotal_intelligence.rbs
1317
1357
  - sig/lib/mihari/type_checker.rbs
1318
1358
  - sig/lib/mihari/types.rbs