mihari 3.4.0 → 3.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. checksums.yaml +4 -4
  2. data/.gitmodules +3 -0
  3. data/README.md +2 -0
  4. data/Steepfile +32 -0
  5. data/config.ru +1 -0
  6. data/lib/mihari/analyzers/base.rb +39 -11
  7. data/lib/mihari/analyzers/binaryedge.rb +13 -0
  8. data/lib/mihari/analyzers/censys.rb +42 -9
  9. data/lib/mihari/analyzers/circl.rb +15 -0
  10. data/lib/mihari/analyzers/crtsh.rb +5 -0
  11. data/lib/mihari/analyzers/dnpedia.rb +5 -0
  12. data/lib/mihari/analyzers/dnstwister.rb +17 -0
  13. data/lib/mihari/analyzers/onyphe.rb +50 -9
  14. data/lib/mihari/analyzers/otx.rb +20 -0
  15. data/lib/mihari/analyzers/passivetotal.rb +25 -0
  16. data/lib/mihari/analyzers/pulsedive.rb +10 -0
  17. data/lib/mihari/analyzers/rule.rb +18 -0
  18. data/lib/mihari/analyzers/securitytrails.rb +25 -0
  19. data/lib/mihari/analyzers/shodan.rb +39 -5
  20. data/lib/mihari/analyzers/spyse.rb +20 -0
  21. data/lib/mihari/analyzers/urlscan.rb +10 -0
  22. data/lib/mihari/analyzers/virustotal.rb +20 -0
  23. data/lib/mihari/analyzers/zoomeye.rb +38 -0
  24. data/lib/mihari/cli/analyzer.rb +1 -0
  25. data/lib/mihari/cli/base.rb +0 -2
  26. data/lib/mihari/commands/init.rb +4 -4
  27. data/lib/mihari/commands/search.rb +1 -0
  28. data/lib/mihari/commands/web.rb +1 -0
  29. data/lib/mihari/{constraints.rb → constants.rb} +0 -0
  30. data/lib/mihari/database.rb +42 -3
  31. data/lib/mihari/emitters/base.rb +1 -1
  32. data/lib/mihari/emitters/misp.rb +38 -5
  33. data/lib/mihari/emitters/slack.rb +20 -2
  34. data/lib/mihari/emitters/the_hive.rb +16 -3
  35. data/lib/mihari/emitters/webhook.rb +18 -3
  36. data/lib/mihari/mixins/disallowed_data_value.rb +1 -1
  37. data/lib/mihari/models/alert.rb +28 -10
  38. data/lib/mihari/models/artifact.rb +55 -0
  39. data/lib/mihari/models/autonomous_system.rb +9 -0
  40. data/lib/mihari/models/dns.rb +53 -0
  41. data/lib/mihari/models/geolocation.rb +9 -0
  42. data/lib/mihari/models/reverse_dns.rb +24 -0
  43. data/lib/mihari/models/whois.rb +119 -0
  44. data/lib/mihari/schemas/configuration.rb +1 -0
  45. data/lib/mihari/schemas/rule.rb +2 -15
  46. data/lib/mihari/serializers/alert.rb +6 -4
  47. data/lib/mihari/serializers/artifact.rb +11 -2
  48. data/lib/mihari/serializers/autonomous_system.rb +9 -0
  49. data/lib/mihari/serializers/dns.rb +11 -0
  50. data/lib/mihari/serializers/geolocation.rb +11 -0
  51. data/lib/mihari/serializers/reverse_dns.rb +11 -0
  52. data/lib/mihari/serializers/tag.rb +4 -2
  53. data/lib/mihari/serializers/whois.rb +11 -0
  54. data/lib/mihari/structs/censys.rb +92 -0
  55. data/lib/mihari/structs/onyphe.rb +47 -0
  56. data/lib/mihari/structs/shodan.rb +53 -0
  57. data/lib/mihari/type_checker.rb +9 -9
  58. data/lib/mihari/types.rb +21 -0
  59. data/lib/mihari/version.rb +1 -1
  60. data/lib/mihari/web/app.rb +2 -0
  61. data/lib/mihari/web/controllers/alerts_controller.rb +3 -4
  62. data/lib/mihari/web/controllers/artifacts_controller.rb +46 -2
  63. data/lib/mihari/web/controllers/ip_address_controller.rb +36 -0
  64. data/lib/mihari/web/controllers/sources_controller.rb +2 -2
  65. data/lib/mihari/web/controllers/tags_controller.rb +3 -1
  66. data/lib/mihari/web/public/index.html +1 -1
  67. data/lib/mihari/web/public/redoc-static.html +12 -10
  68. data/lib/mihari/web/public/static/fonts/fa-brands-400.1a575a41.woff +0 -0
  69. data/lib/mihari/web/public/static/fonts/fa-brands-400.513aa607.ttf +0 -0
  70. data/lib/mihari/web/public/static/fonts/fa-brands-400.592643a8.eot +0 -0
  71. data/lib/mihari/web/public/static/fonts/fa-brands-400.ed311c7a.woff2 +0 -0
  72. data/lib/mihari/web/public/static/fonts/fa-regular-400.766913e6.ttf +0 -0
  73. data/lib/mihari/web/public/static/fonts/fa-regular-400.b0e2db3b.eot +0 -0
  74. data/lib/mihari/web/public/static/fonts/fa-regular-400.b91d376b.woff2 +0 -0
  75. data/lib/mihari/web/public/static/fonts/fa-regular-400.d1d7e3b4.woff +0 -0
  76. data/lib/mihari/web/public/static/fonts/fa-solid-900.0c6bfc66.eot +0 -0
  77. data/lib/mihari/web/public/static/fonts/fa-solid-900.b9625119.ttf +0 -0
  78. data/lib/mihari/web/public/static/fonts/fa-solid-900.d745348d.woff +0 -0
  79. data/lib/mihari/web/public/static/fonts/fa-solid-900.d824df7e.woff2 +0 -0
  80. data/lib/mihari/web/public/static/img/fa-brands-400.1d5619cd.svg +3717 -0
  81. data/lib/mihari/web/public/static/img/fa-regular-400.c5d109be.svg +801 -0
  82. data/lib/mihari/web/public/static/img/fa-solid-900.37bc7099.svg +5034 -0
  83. data/lib/mihari/web/public/static/js/app.8e3e5150.js +36 -0
  84. data/lib/mihari/web/public/static/js/app.8e3e5150.js.map +1 -0
  85. data/lib/mihari/web/public/static/js/app.b5914c39.js +36 -0
  86. data/lib/mihari/web/public/static/js/app.b5914c39.js.map +1 -0
  87. data/lib/mihari.rb +25 -4
  88. data/mihari.gemspec +10 -2
  89. data/sig/lib/mihari/analyzers/base.rbs +99 -0
  90. data/sig/lib/mihari/analyzers/basic.rbs +17 -0
  91. data/sig/lib/mihari/analyzers/binaryedge.rbs +25 -0
  92. data/sig/lib/mihari/analyzers/censys.rbs +38 -0
  93. data/sig/lib/mihari/analyzers/circl.rbs +29 -0
  94. data/sig/lib/mihari/analyzers/crtsh.rbs +19 -0
  95. data/sig/lib/mihari/analyzers/dnpedia.rbs +18 -0
  96. data/sig/lib/mihari/analyzers/dnstwister.rbs +27 -0
  97. data/sig/lib/mihari/analyzers/onyphe.rbs +33 -0
  98. data/sig/lib/mihari/analyzers/otx.rbs +33 -0
  99. data/sig/lib/mihari/analyzers/passivetotal.rbs +33 -0
  100. data/sig/lib/mihari/analyzers/pulsedive.rbs +27 -0
  101. data/sig/lib/mihari/analyzers/rule.rbs +68 -0
  102. data/sig/lib/mihari/analyzers/securitytrails.rbs +33 -0
  103. data/sig/lib/mihari/analyzers/shodan.rbs +33 -0
  104. data/sig/lib/mihari/analyzers/spyse.rbs +29 -0
  105. data/sig/lib/mihari/analyzers/urlscan.rbs +28 -0
  106. data/sig/lib/mihari/analyzers/virustotal.rbs +31 -0
  107. data/sig/lib/mihari/analyzers/zoomeye.rbs +33 -0
  108. data/sig/lib/mihari/cli/analyzer.rbs +39 -0
  109. data/sig/lib/mihari/cli/base.rbs +11 -0
  110. data/sig/lib/mihari/cli/init.rbs +7 -0
  111. data/sig/lib/mihari/cli/main.rbs +9 -0
  112. data/sig/lib/mihari/cli/mixins/utils.rbs +50 -0
  113. data/sig/lib/mihari/cli/validator.rbs +7 -0
  114. data/sig/lib/mihari/commands/binaryedge.rbs +7 -0
  115. data/sig/lib/mihari/commands/censys.rbs +7 -0
  116. data/sig/lib/mihari/commands/circl.rbs +7 -0
  117. data/sig/lib/mihari/commands/crtsh.rbs +7 -0
  118. data/sig/lib/mihari/commands/dnpedia.rbs +7 -0
  119. data/sig/lib/mihari/commands/dnstwister.rbs +7 -0
  120. data/sig/lib/mihari/commands/init.rbs +11 -0
  121. data/sig/lib/mihari/commands/json.rbs +7 -0
  122. data/sig/lib/mihari/commands/onyphe.rbs +7 -0
  123. data/sig/lib/mihari/commands/otx.rbs +7 -0
  124. data/sig/lib/mihari/commands/passivetotal.rbs +7 -0
  125. data/sig/lib/mihari/commands/pulsedive.rbs +7 -0
  126. data/sig/lib/mihari/commands/search.rbs +35 -0
  127. data/sig/lib/mihari/commands/securitytrails.rbs +7 -0
  128. data/sig/lib/mihari/commands/shodan.rbs +7 -0
  129. data/sig/lib/mihari/commands/spyse.rbs +7 -0
  130. data/sig/lib/mihari/commands/urlscan.rbs +7 -0
  131. data/sig/lib/mihari/commands/validator.rbs +11 -0
  132. data/sig/lib/mihari/commands/virustotal.rbs +7 -0
  133. data/sig/lib/mihari/commands/web.rbs +7 -0
  134. data/sig/lib/mihari/commands/zoomeye.rbs +7 -0
  135. data/sig/lib/mihari/constants.rbs +3 -0
  136. data/sig/lib/mihari/database.rbs +25 -0
  137. data/sig/lib/mihari/emitters/base.rbs +18 -0
  138. data/sig/lib/mihari/emitters/database.rbs +9 -0
  139. data/sig/lib/mihari/emitters/misp.rbs +28 -0
  140. data/sig/lib/mihari/emitters/slack.rbs +58 -0
  141. data/sig/lib/mihari/emitters/stdout.rbs +9 -0
  142. data/sig/lib/mihari/emitters/the_hive.rbs +24 -0
  143. data/sig/lib/mihari/emitters/webhook.rbs +20 -0
  144. data/sig/lib/mihari/errors.rbs +10 -0
  145. data/sig/lib/mihari/mixins/configurable.rbs +26 -0
  146. data/sig/lib/mihari/mixins/configuration.rbs +45 -0
  147. data/sig/lib/mihari/mixins/disallowed_data_value.rbs +25 -0
  148. data/sig/lib/mihari/mixins/hash.rbs +14 -0
  149. data/sig/lib/mihari/mixins/refang.rbs +14 -0
  150. data/sig/lib/mihari/mixins/retriable.rbs +15 -0
  151. data/sig/lib/mihari/mixins/rule.rbs +41 -0
  152. data/sig/lib/mihari/models/alert.rbs +46 -0
  153. data/sig/lib/mihari/models/artifact.rbs +54 -0
  154. data/sig/lib/mihari/models/autonomous_system.rbs +5 -0
  155. data/sig/lib/mihari/models/dns.rbs +19 -0
  156. data/sig/lib/mihari/models/geolocation.rbs +6 -0
  157. data/sig/lib/mihari/models/reverse_dns.rbs +14 -0
  158. data/sig/lib/mihari/models/tag.rbs +5 -0
  159. data/sig/lib/mihari/models/tagging.rbs +4 -0
  160. data/sig/lib/mihari/models/whois.rbs +66 -0
  161. data/sig/lib/mihari/notifiers/base.rbs +18 -0
  162. data/sig/lib/mihari/notifiers/exception_notifier.rbs +75 -0
  163. data/sig/lib/mihari/notifiers/slack.rbs +50 -0
  164. data/sig/lib/mihari/status.rbs +25 -0
  165. data/sig/lib/mihari/structs/censys.rbs +50 -0
  166. data/sig/lib/mihari/structs/onyphe.rbs +25 -0
  167. data/sig/lib/mihari/structs/shodan.rbs +28 -0
  168. data/sig/lib/mihari/type_checker.rbs +48 -0
  169. data/sig/lib/mihari/types.rbs +17 -0
  170. data/sig/lib/mihari/version.rbs +3 -0
  171. data/sig/lib/mihari/web/app.rbs +5 -0
  172. data/sig/lib/mihari.rbs +57 -0
  173. metadata +240 -8
@@ -0,0 +1,18 @@
1
+ module Mihari
2
+ module Notifiers
3
+ class Base
4
+ # Validate notifier availability
5
+ #
6
+ # @return [Boolean]
7
+ #
8
+ def valid?: () -> bool
9
+
10
+ #
11
+ # Send a notification
12
+ #
13
+ # @return [nil]
14
+ #
15
+ def notify: () -> void
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,75 @@
1
+ module Mihari
2
+ module Notifiers
3
+ class ExceptionNotifier
4
+ def initialize: () -> void
5
+
6
+ def valid?: () -> bool
7
+
8
+ def notify: (Exception exception) -> void
9
+
10
+ #
11
+ # Send notification to Slack
12
+ #
13
+ # @param [String] text
14
+ # @param [Array<Hash>] attachments
15
+ #
16
+ # @return [nil]
17
+ #
18
+ def notify_to_slack: (text: String text, attachments: Array[Hash[(String | Symbol), untyped]] attachments) -> void
19
+
20
+ #
21
+ # Send notification to STDOUT
22
+ #
23
+ # @param [Exception] exception
24
+ #
25
+ # @return [nil]
26
+ #
27
+ def notify_to_stdout: (Exception exception) -> void
28
+
29
+ #
30
+ # Convert exception to attachments (for Slack)
31
+ #
32
+ # @param [Exception] exception
33
+ # @param [String] clean_message
34
+ #
35
+ # @return [Array<Hash>]
36
+ #
37
+ def to_attachments: (Exception exception, String clean_message) -> ::Array[{ color: untyped, text: untyped, fields: untyped, :mrkdwn_in => ::Array["text" | "fields"] }]
38
+
39
+ #
40
+ # Convert exception class to text
41
+ #
42
+ # @param [Class<Exception>] exception_class
43
+ #
44
+ # @return [String]
45
+ #
46
+ def to_text: (singleton(Exception) exception_class) -> ::String
47
+
48
+ #
49
+ # Convert clean_message and backtrace into fields (for Slack)
50
+ #
51
+ # @param [String] clean_message
52
+ # @param [Array] backtrace
53
+ #
54
+ # @return [Array<Hash>]
55
+ #
56
+ def to_fields: (String clean_message, untyped backtrace) -> Array[Hash[(String | Symbol), untyped]]
57
+
58
+ #
59
+ # Hostname of runnning instance
60
+ #
61
+ # @return [String]
62
+ #
63
+ def hostname: () -> String
64
+
65
+ #
66
+ # Format backtrace in string
67
+ #
68
+ # @param [Array] backtrace
69
+ #
70
+ # @return [String]
71
+ #
72
+ def format_backtrace: (untyped backtrace) -> (nil | ::String)
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,50 @@
1
+ module Mihari
2
+ module Notifiers
3
+ class Slack < Base
4
+ SLACK_WEBHOOK_URL_KEY: ::String
5
+
6
+ SLACK_CHANNEL_KEY: ::String
7
+
8
+ DEFAULT_USERNAME: ::String
9
+
10
+ #
11
+ # Slack channel to post
12
+ #
13
+ # @return [String]
14
+ #
15
+ def slack_channel: () -> String
16
+
17
+ #
18
+ # Slack webhook URL
19
+ #
20
+ # @return [String]
21
+ #
22
+ def slack_webhook_url: () -> String
23
+
24
+ #
25
+ # Check Slack webhook URL is set
26
+ #
27
+ # @return [Boolean]
28
+ #
29
+ def slack_webhook_url?: () -> bool
30
+
31
+ #
32
+ # Check Slack webhook URL is set. Alias of #slack_webhook_url?.
33
+ #
34
+ # @return [Boolean]
35
+ #
36
+ def valid?: () -> bool
37
+
38
+ #
39
+ # Send notification to Slack
40
+ #
41
+ # @param [String] text
42
+ # @param [Array<Hash>] attachments
43
+ # @param [Boolean] mrkdwn
44
+ #
45
+ # @return [nil]
46
+ #
47
+ def notify: (text: String text, ?attachments: Array[Hash[(String | Symbol), untyped]] attachments, ?mrkdwn: bool mrkdwn) -> untyped
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,25 @@
1
+ module Mihari
2
+ class Status
3
+ def check: () -> Array[Hash[(String | Symbol), untyped]]
4
+
5
+ def self.check: () -> Array[Hash[(String | Symbol), untyped]]
6
+
7
+ private
8
+
9
+ #
10
+ # Statuses of analyzers and emitters
11
+ #
12
+ # @return [Array<Hash>]
13
+ #
14
+ def statuses: () -> Array[Hash[(String | Symbol), untyped]]
15
+
16
+ #
17
+ # Build a status of a class
18
+ #
19
+ # @param [Class<Mihari::Analyzers::Base>, Class<Mihari::Emitters::Base>] klass
20
+ #
21
+ # @return [Hash, nil]
22
+ #
23
+ def build_status: (singleton(Mihari::Analyzers::Base) | singleton(Mihari::Emitters::Base)) -> Hash[(String|Symbol), untyped]?
24
+ end
25
+ end
@@ -0,0 +1,50 @@
1
+ module Mihari
2
+ module Structs
3
+ module Censys
4
+ class AutonomousSystem
5
+ attr_reader asn: Integer
6
+
7
+ def self.from_dynamic!: (Hash[(String | Symbol), untyped] d) -> Mihari::Structs::Censys::AutonomousSystem
8
+ end
9
+
10
+ class Location
11
+ attr_reader country: String
12
+ attr_reader country_code: String
13
+
14
+ def self.from_dynamic!: (Hash[(String | Symbol), untyped] d) -> Mihari::Structs::Censys::Location
15
+ end
16
+
17
+ class Hit
18
+ attr_reader ip: String
19
+ attr_reader location: Mihari::Structs::Censys::Location
20
+ attr_reader autonomous_system: Mihari::Structs::Censys::AutonomousSystem
21
+
22
+ def self.from_dynamic!: (Hash[(String | Symbol), untyped] d) -> Mihari::Structs::Censys::Hit
23
+ end
24
+
25
+ class Links
26
+ attr_reader next: String
27
+ attr_reader prev: String
28
+
29
+ def self.from_dynamic!: (Hash[(String | Symbol), untyped] d) -> Mihari::Structs::Censys::Links
30
+ end
31
+
32
+ class Result
33
+ attr_reader query: String
34
+ attr_reader total: Integer
35
+ attr_reader hits: Array[Mihari::Structs::Censys::Hit]
36
+ attr_reader links: Mihari::Structs::Censys::Links
37
+
38
+ def self.from_dynamic!: (Hash[(String | Symbol), untyped] d) -> Mihari::Structs::Censys::Result
39
+ end
40
+
41
+ class Response
42
+ attr_reader code: Integer
43
+ attr_reader status: String
44
+ attr_reader result: Mihari::Structs::Censys::Result
45
+
46
+ def self.from_dynamic!: (Hash[(String | Symbol), untyped] d) -> Mihari::Structs::Censys::Response
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,25 @@
1
+ module Mihari
2
+ module Structs
3
+ module Onyphe
4
+ class Result
5
+ attr_reader asn: String
6
+ attr_reader country_code: String?
7
+ attr_reader ip: String
8
+
9
+ def self.from_dynamic!: (Hash[(String | Symbol), untyped] d) -> Mihari::Structs::Onyphe::Result
10
+ end
11
+
12
+ class Response
13
+ attr_reader count: Integer
14
+ attr_reader error: Integer
15
+ attr_reader max_page: Integer
16
+ attr_reader page: String
17
+ attr_reader results: Array[Mihari::Structs::Onyphe::Result]
18
+ attr_reader status: String
19
+ attr_reader total: Integer
20
+
21
+ def self.from_dynamic!: (Hash[(String | Symbol), untyped] d) -> Mihari::Structs::Onyphe::Response
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,28 @@
1
+ module Mihari
2
+ module Structs
3
+ module Shodan
4
+ class Location
5
+ attr_reader country_code: String
6
+ attr_reader country_name: String
7
+
8
+ def self.from_dynamic!: (Hash[(String | Symbol), untyped] d) -> Mihari::Structs::Shodan::Location
9
+ end
10
+
11
+ class Match
12
+ attr_reader asn: String
13
+ attr_reader hostnames: Array[String]
14
+ attr_reader location: Mihari::Structs::Shodan::Location
15
+ attr_reader domains: Array[String]
16
+ attr_reader ip_str: String
17
+ def self.from_dynamic!: (Hash[(String | Symbol), untyped] d) -> Mihari::Structs::Shodan::Match
18
+ end
19
+
20
+ class Result
21
+ attr_reader matches: Array[Mihari::Structs::Shodan::Match]
22
+ attr_reader total: Integer
23
+
24
+ def self.from_dynamic!: (Hash[(String | Symbol), untyped] d) -> Mihari::Structs::Shodan::Result
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,48 @@
1
+ module Mihari
2
+ class TypeChecker
3
+ # extend Dry::Initializer
4
+
5
+ def initialize: (*untyped args, **untyped kwargs) -> void
6
+
7
+ # @return [true, false]
8
+ def hash?: () -> bool
9
+
10
+ # @return [true, false]
11
+ def ip?: () -> bool
12
+
13
+ # @return [true, false]
14
+ def domain?: () -> bool
15
+
16
+ # @return [true, false]
17
+ def url?: () -> bool
18
+
19
+ # @return [true, false]
20
+ def mail?: () -> bool
21
+
22
+ # @return [String, nil]
23
+ def type: () -> ("hash" | "ip" | "domain" | "url" | nil)
24
+
25
+ # @return [String, nil]
26
+ def detailed_type: () -> ("md5" | "sha1" | "sha256" | "sha512" | nil)
27
+
28
+ # @return [String, nil]
29
+ def self.type: (untyped data) -> String?
30
+
31
+ # @return [String, nil]
32
+ def self.detailed_type: (untyped data) -> String?
33
+
34
+ private
35
+
36
+ # @return [true, false]
37
+ def md5?: () -> bool
38
+
39
+ # @return [true, false]
40
+ def sha1?: () -> bool
41
+
42
+ # @return [true, false]
43
+ def sha256?: () -> bool
44
+
45
+ # @return [true, false]
46
+ def sha512?: () -> bool
47
+ end
48
+ end
@@ -0,0 +1,17 @@
1
+ module Mihari
2
+ module Types
3
+ Int: ::Integer
4
+
5
+ Nil: nil
6
+
7
+ Hash: Hash[(String | Symbol), untyped]
8
+
9
+ String: ::String
10
+
11
+ Double: (::Float | ::Integer)
12
+
13
+ DataTypes: Array[String]
14
+
15
+ AnalyzerTypes: Array[String]
16
+ end
17
+ end
@@ -0,0 +1,3 @@
1
+ module Mihari
2
+ VERSION: ::String
3
+ end
@@ -0,0 +1,5 @@
1
+ module Mihari
2
+ class App # < Sinatra::Base
3
+ def self.run!: (?port: ::Integer port, ?host: ::String host) -> void
4
+ end
5
+ end
@@ -0,0 +1,57 @@
1
+ class Configuration
2
+ attr_accessor binaryedge_api_key (): String?
3
+ attr_accessor censys_id (): String?
4
+ attr_accessor censys_secret (): String?
5
+ attr_accessor circl_passive_password (): String?
6
+ attr_accessor circl_passive_username (): String?
7
+ attr_accessor ipinfo_api_key (): String?
8
+ attr_accessor misp_api_endpoint (): String?
9
+ attr_accessor misp_api_key (): String?
10
+ attr_accessor onyphe_api_key (): String?
11
+ attr_accessor otx_api_key (): String?
12
+ attr_accessor passivetotal_api_key (): String?
13
+ attr_accessor passivetotal_username (): String?
14
+ attr_accessor pulsedive_api_key (): String?
15
+ attr_accessor securitytrails_api_key (): String?
16
+ attr_accessor shodan_api_key (): String?
17
+ attr_accessor slack_channel (): String?
18
+ attr_accessor slack_webhook_url (): String?
19
+ attr_accessor spyse_api_key (): String?
20
+ attr_accessor thehive_api_endpoint (): String?
21
+ attr_accessor thehive_api_key (): String?
22
+ attr_accessor urlscan_api_key (): String?
23
+ attr_accessor virustotal_api_key (): String?
24
+ attr_accessor zoomeye_api_key (): String?
25
+ attr_accessor webhook_url (): String?
26
+ attr_accessor webhook_use_json_body (): (bool | nil)
27
+ attr_accessor database (): String?
28
+
29
+ attr_reader values: Hash[(String | Symbol), String?]
30
+ end
31
+
32
+ module Mihari
33
+ def self.config: () -> Configuration
34
+
35
+ # extend Dry::Configurable
36
+
37
+ extend Mixins::Configuration
38
+
39
+ # include Mem
40
+
41
+ def self.emitters: () -> ::Array[singleton(Mihari::Emitters::Base)]
42
+
43
+ def self.analyzers: () -> ::Array[singleton(Mihari::Analyzers::Base)]
44
+
45
+ #
46
+ # Load configuration from YAML file
47
+ #
48
+ # @param [String] path Path to YAML file
49
+ #
50
+ # @return [nil]
51
+ #
52
+ def self.load_config_from_yaml: (String path) -> void
53
+ end
54
+
55
+ class Object
56
+ def truthy?: (untyped value) -> bool
57
+ 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.4.0
4
+ version: 3.6.1
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-08-07 00:00:00.000000000 Z
11
+ date: 2021-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -122,6 +122,34 @@ dependencies:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: '13.0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rb-fsevent
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '0.11'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '0.11'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rerun
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '0.13'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '0.13'
125
153
  - !ruby/object:Gem::Dependency
126
154
  name: rspec
127
155
  requirement: !ruby/object:Gem::Requirement
@@ -142,14 +170,28 @@ dependencies:
142
170
  requirements:
143
171
  - - "~>"
144
172
  - !ruby/object:Gem::Version
145
- version: '1.1'
173
+ version: '1.2'
146
174
  type: :development
147
175
  prerelease: false
148
176
  version_requirements: !ruby/object:Gem::Requirement
149
177
  requirements:
150
178
  - - "~>"
151
179
  - !ruby/object:Gem::Version
152
- version: '1.1'
180
+ version: '1.2'
181
+ - !ruby/object:Gem::Dependency
182
+ name: steep
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: '0.45'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: '0.45'
153
195
  - !ruby/object:Gem::Dependency
154
196
  name: timecop
155
197
  requirement: !ruby/object:Gem::Requirement
@@ -184,14 +226,14 @@ dependencies:
184
226
  requirements:
185
227
  - - "~>"
186
228
  - !ruby/object:Gem::Version
187
- version: '3.13'
229
+ version: '3.14'
188
230
  type: :development
189
231
  prerelease: false
190
232
  version_requirements: !ruby/object:Gem::Requirement
191
233
  requirements:
192
234
  - - "~>"
193
235
  - !ruby/object:Gem::Version
194
- version: '3.13'
236
+ version: '3.14'
195
237
  - !ruby/object:Gem::Dependency
196
238
  name: active_model_serializers
197
239
  requirement: !ruby/object:Gem::Requirement
@@ -402,6 +444,20 @@ dependencies:
402
444
  - - "~>"
403
445
  - !ruby/object:Gem::Version
404
446
  version: '3.0'
447
+ - !ruby/object:Gem::Dependency
448
+ name: dry-struct
449
+ requirement: !ruby/object:Gem::Requirement
450
+ requirements:
451
+ - - "~>"
452
+ - !ruby/object:Gem::Version
453
+ version: '1.4'
454
+ type: :runtime
455
+ prerelease: false
456
+ version_requirements: !ruby/object:Gem::Requirement
457
+ requirements:
458
+ - - "~>"
459
+ - !ruby/object:Gem::Version
460
+ version: '1.4'
405
461
  - !ruby/object:Gem::Dependency
406
462
  name: dry-validation
407
463
  requirement: !ruby/object:Gem::Requirement
@@ -444,6 +500,20 @@ dependencies:
444
500
  - - "~>"
445
501
  - !ruby/object:Gem::Version
446
502
  version: '1.0'
503
+ - !ruby/object:Gem::Dependency
504
+ name: http
505
+ requirement: !ruby/object:Gem::Requirement
506
+ requirements:
507
+ - - "~>"
508
+ - !ruby/object:Gem::Version
509
+ version: '5.0'
510
+ type: :runtime
511
+ prerelease: false
512
+ version_requirements: !ruby/object:Gem::Requirement
513
+ requirements:
514
+ - - "~>"
515
+ - !ruby/object:Gem::Version
516
+ version: '5.0'
447
517
  - !ruby/object:Gem::Dependency
448
518
  name: launchy
449
519
  requirement: !ruby/object:Gem::Requirement
@@ -500,6 +570,20 @@ dependencies:
500
570
  - - "~>"
501
571
  - !ruby/object:Gem::Version
502
572
  version: '2.0'
573
+ - !ruby/object:Gem::Dependency
574
+ name: normalize_country
575
+ requirement: !ruby/object:Gem::Requirement
576
+ requirements:
577
+ - - '='
578
+ - !ruby/object:Gem::Version
579
+ version: '0.3'
580
+ type: :runtime
581
+ prerelease: false
582
+ version_requirements: !ruby/object:Gem::Requirement
583
+ requirements:
584
+ - - '='
585
+ - !ruby/object:Gem::Version
586
+ version: '0.3'
503
587
  - !ruby/object:Gem::Dependency
504
588
  name: onyphe
505
589
  requirement: !ruby/object:Gem::Requirement
@@ -836,6 +920,34 @@ dependencies:
836
920
  - - "~>"
837
921
  - !ruby/object:Gem::Version
838
922
  version: '1.1'
923
+ - !ruby/object:Gem::Dependency
924
+ name: whois
925
+ requirement: !ruby/object:Gem::Requirement
926
+ requirements:
927
+ - - "~>"
928
+ - !ruby/object:Gem::Version
929
+ version: '5.0'
930
+ type: :runtime
931
+ prerelease: false
932
+ version_requirements: !ruby/object:Gem::Requirement
933
+ requirements:
934
+ - - "~>"
935
+ - !ruby/object:Gem::Version
936
+ version: '5.0'
937
+ - !ruby/object:Gem::Dependency
938
+ name: whois-parser
939
+ requirement: !ruby/object:Gem::Requirement
940
+ requirements:
941
+ - - "~>"
942
+ - !ruby/object:Gem::Version
943
+ version: '1.2'
944
+ type: :runtime
945
+ prerelease: false
946
+ version_requirements: !ruby/object:Gem::Requirement
947
+ requirements:
948
+ - - "~>"
949
+ - !ruby/object:Gem::Version
950
+ version: '1.2'
839
951
  - !ruby/object:Gem::Dependency
840
952
  name: zoomeye-rb
841
953
  requirement: !ruby/object:Gem::Requirement
@@ -862,6 +974,7 @@ files:
862
974
  - ".github/ISSUE_TEMPLATE/feature_request.md"
863
975
  - ".github/workflows/test.yml"
864
976
  - ".gitignore"
977
+ - ".gitmodules"
865
978
  - ".overcommit.yml"
866
979
  - ".rspec"
867
980
  - ".standard.yml"
@@ -869,6 +982,7 @@ files:
869
982
  - LICENSE
870
983
  - README.md
871
984
  - Rakefile
985
+ - Steepfile
872
986
  - bin/console
873
987
  - bin/setup
874
988
  - build_frontend.sh
@@ -932,7 +1046,7 @@ files:
932
1046
  - lib/mihari/commands/virustotal.rb
933
1047
  - lib/mihari/commands/web.rb
934
1048
  - lib/mihari/commands/zoomeye.rb
935
- - lib/mihari/constraints.rb
1049
+ - lib/mihari/constants.rb
936
1050
  - lib/mihari/database.rb
937
1051
  - lib/mihari/emitters/base.rb
938
1052
  - lib/mihari/emitters/database.rb
@@ -951,8 +1065,13 @@ files:
951
1065
  - lib/mihari/mixins/rule.rb
952
1066
  - lib/mihari/models/alert.rb
953
1067
  - lib/mihari/models/artifact.rb
1068
+ - lib/mihari/models/autonomous_system.rb
1069
+ - lib/mihari/models/dns.rb
1070
+ - lib/mihari/models/geolocation.rb
1071
+ - lib/mihari/models/reverse_dns.rb
954
1072
  - lib/mihari/models/tag.rb
955
1073
  - lib/mihari/models/tagging.rb
1074
+ - lib/mihari/models/whois.rb
956
1075
  - lib/mihari/notifiers/base.rb
957
1076
  - lib/mihari/notifiers/exception_notifier.rb
958
1077
  - lib/mihari/notifiers/slack.rb
@@ -962,10 +1081,19 @@ files:
962
1081
  - lib/mihari/schemas/rule.rb
963
1082
  - lib/mihari/serializers/alert.rb
964
1083
  - lib/mihari/serializers/artifact.rb
1084
+ - lib/mihari/serializers/autonomous_system.rb
1085
+ - lib/mihari/serializers/dns.rb
1086
+ - lib/mihari/serializers/geolocation.rb
1087
+ - lib/mihari/serializers/reverse_dns.rb
965
1088
  - lib/mihari/serializers/tag.rb
1089
+ - lib/mihari/serializers/whois.rb
966
1090
  - lib/mihari/status.rb
1091
+ - lib/mihari/structs/censys.rb
1092
+ - lib/mihari/structs/onyphe.rb
1093
+ - lib/mihari/structs/shodan.rb
967
1094
  - lib/mihari/templates/rule.yml.erb
968
1095
  - lib/mihari/type_checker.rb
1096
+ - lib/mihari/types.rb
969
1097
  - lib/mihari/version.rb
970
1098
  - lib/mihari/web/app.rb
971
1099
  - lib/mihari/web/controllers/alerts_controller.rb
@@ -974,6 +1102,7 @@ files:
974
1102
  - lib/mihari/web/controllers/base_controller.rb
975
1103
  - lib/mihari/web/controllers/command_controller.rb
976
1104
  - lib/mihari/web/controllers/config_controller.rb
1105
+ - lib/mihari/web/controllers/ip_address_controller.rb
977
1106
  - lib/mihari/web/controllers/sources_controller.rb
978
1107
  - lib/mihari/web/controllers/tags_controller.rb
979
1108
  - lib/mihari/web/helpers/json.rb
@@ -981,28 +1110,131 @@ files:
981
1110
  - lib/mihari/web/public/redoc-static.html
982
1111
  - lib/mihari/web/public/static/favicon.ico
983
1112
  - lib/mihari/web/public/static/fonts/fa-brands-400.099a9556.woff
1113
+ - lib/mihari/web/public/static/fonts/fa-brands-400.1a575a41.woff
984
1114
  - lib/mihari/web/public/static/fonts/fa-brands-400.30cc681d.eot
985
1115
  - lib/mihari/web/public/static/fonts/fa-brands-400.3b89dd10.ttf
1116
+ - lib/mihari/web/public/static/fonts/fa-brands-400.513aa607.ttf
1117
+ - lib/mihari/web/public/static/fonts/fa-brands-400.592643a8.eot
1118
+ - lib/mihari/web/public/static/fonts/fa-brands-400.ed311c7a.woff2
986
1119
  - lib/mihari/web/public/static/fonts/fa-brands-400.f7307680.woff2
987
1120
  - lib/mihari/web/public/static/fonts/fa-regular-400.1f77739c.ttf
988
1121
  - lib/mihari/web/public/static/fonts/fa-regular-400.7124eb50.woff
989
1122
  - lib/mihari/web/public/static/fonts/fa-regular-400.7630483d.eot
1123
+ - lib/mihari/web/public/static/fonts/fa-regular-400.766913e6.ttf
1124
+ - lib/mihari/web/public/static/fonts/fa-regular-400.b0e2db3b.eot
1125
+ - lib/mihari/web/public/static/fonts/fa-regular-400.b91d376b.woff2
1126
+ - lib/mihari/web/public/static/fonts/fa-regular-400.d1d7e3b4.woff
990
1127
  - lib/mihari/web/public/static/fonts/fa-regular-400.f0f82301.woff2
1128
+ - lib/mihari/web/public/static/fonts/fa-solid-900.0c6bfc66.eot
991
1129
  - lib/mihari/web/public/static/fonts/fa-solid-900.1042e8ca.eot
992
1130
  - lib/mihari/web/public/static/fonts/fa-solid-900.605ed792.ttf
993
1131
  - lib/mihari/web/public/static/fonts/fa-solid-900.9fe5a17c.woff
1132
+ - lib/mihari/web/public/static/fonts/fa-solid-900.b9625119.ttf
1133
+ - lib/mihari/web/public/static/fonts/fa-solid-900.d745348d.woff
1134
+ - lib/mihari/web/public/static/fonts/fa-solid-900.d824df7e.woff2
994
1135
  - lib/mihari/web/public/static/fonts/fa-solid-900.e8a427e1.woff2
1136
+ - lib/mihari/web/public/static/img/fa-brands-400.1d5619cd.svg
995
1137
  - lib/mihari/web/public/static/img/fa-brands-400.ba7ed552.svg
996
1138
  - lib/mihari/web/public/static/img/fa-regular-400.0bb42845.svg
1139
+ - lib/mihari/web/public/static/img/fa-regular-400.c5d109be.svg
997
1140
  - lib/mihari/web/public/static/img/fa-solid-900.376c1f97.svg
1141
+ - lib/mihari/web/public/static/img/fa-solid-900.37bc7099.svg
998
1142
  - lib/mihari/web/public/static/js/app.365f1907.js
999
1143
  - lib/mihari/web/public/static/js/app.365f1907.js.map
1144
+ - lib/mihari/web/public/static/js/app.8e3e5150.js
1145
+ - lib/mihari/web/public/static/js/app.8e3e5150.js.map
1000
1146
  - lib/mihari/web/public/static/js/app.ab213f7c.js
1001
1147
  - lib/mihari/web/public/static/js/app.ab213f7c.js.map
1148
+ - lib/mihari/web/public/static/js/app.b5914c39.js
1149
+ - lib/mihari/web/public/static/js/app.b5914c39.js.map
1002
1150
  - lib/mihari/web/public/static/js/app.cccddb2b.js
1003
1151
  - lib/mihari/web/public/static/js/app.cccddb2b.js.map
1004
1152
  - mihari.gemspec
1005
1153
  - renovate.json
1154
+ - sig/lib/mihari.rbs
1155
+ - sig/lib/mihari/analyzers/base.rbs
1156
+ - sig/lib/mihari/analyzers/basic.rbs
1157
+ - sig/lib/mihari/analyzers/binaryedge.rbs
1158
+ - sig/lib/mihari/analyzers/censys.rbs
1159
+ - sig/lib/mihari/analyzers/circl.rbs
1160
+ - sig/lib/mihari/analyzers/crtsh.rbs
1161
+ - sig/lib/mihari/analyzers/dnpedia.rbs
1162
+ - sig/lib/mihari/analyzers/dnstwister.rbs
1163
+ - sig/lib/mihari/analyzers/onyphe.rbs
1164
+ - sig/lib/mihari/analyzers/otx.rbs
1165
+ - sig/lib/mihari/analyzers/passivetotal.rbs
1166
+ - sig/lib/mihari/analyzers/pulsedive.rbs
1167
+ - sig/lib/mihari/analyzers/rule.rbs
1168
+ - sig/lib/mihari/analyzers/securitytrails.rbs
1169
+ - sig/lib/mihari/analyzers/shodan.rbs
1170
+ - sig/lib/mihari/analyzers/spyse.rbs
1171
+ - sig/lib/mihari/analyzers/urlscan.rbs
1172
+ - sig/lib/mihari/analyzers/virustotal.rbs
1173
+ - sig/lib/mihari/analyzers/zoomeye.rbs
1174
+ - sig/lib/mihari/cli/analyzer.rbs
1175
+ - sig/lib/mihari/cli/base.rbs
1176
+ - sig/lib/mihari/cli/init.rbs
1177
+ - sig/lib/mihari/cli/main.rbs
1178
+ - sig/lib/mihari/cli/mixins/utils.rbs
1179
+ - sig/lib/mihari/cli/validator.rbs
1180
+ - sig/lib/mihari/commands/binaryedge.rbs
1181
+ - sig/lib/mihari/commands/censys.rbs
1182
+ - sig/lib/mihari/commands/circl.rbs
1183
+ - sig/lib/mihari/commands/crtsh.rbs
1184
+ - sig/lib/mihari/commands/dnpedia.rbs
1185
+ - sig/lib/mihari/commands/dnstwister.rbs
1186
+ - sig/lib/mihari/commands/init.rbs
1187
+ - sig/lib/mihari/commands/json.rbs
1188
+ - sig/lib/mihari/commands/onyphe.rbs
1189
+ - sig/lib/mihari/commands/otx.rbs
1190
+ - sig/lib/mihari/commands/passivetotal.rbs
1191
+ - sig/lib/mihari/commands/pulsedive.rbs
1192
+ - sig/lib/mihari/commands/search.rbs
1193
+ - sig/lib/mihari/commands/securitytrails.rbs
1194
+ - sig/lib/mihari/commands/shodan.rbs
1195
+ - sig/lib/mihari/commands/spyse.rbs
1196
+ - sig/lib/mihari/commands/urlscan.rbs
1197
+ - sig/lib/mihari/commands/validator.rbs
1198
+ - sig/lib/mihari/commands/virustotal.rbs
1199
+ - sig/lib/mihari/commands/web.rbs
1200
+ - sig/lib/mihari/commands/zoomeye.rbs
1201
+ - sig/lib/mihari/constants.rbs
1202
+ - sig/lib/mihari/database.rbs
1203
+ - sig/lib/mihari/emitters/base.rbs
1204
+ - sig/lib/mihari/emitters/database.rbs
1205
+ - sig/lib/mihari/emitters/misp.rbs
1206
+ - sig/lib/mihari/emitters/slack.rbs
1207
+ - sig/lib/mihari/emitters/stdout.rbs
1208
+ - sig/lib/mihari/emitters/the_hive.rbs
1209
+ - sig/lib/mihari/emitters/webhook.rbs
1210
+ - sig/lib/mihari/errors.rbs
1211
+ - sig/lib/mihari/mixins/configurable.rbs
1212
+ - sig/lib/mihari/mixins/configuration.rbs
1213
+ - sig/lib/mihari/mixins/disallowed_data_value.rbs
1214
+ - sig/lib/mihari/mixins/hash.rbs
1215
+ - sig/lib/mihari/mixins/refang.rbs
1216
+ - sig/lib/mihari/mixins/retriable.rbs
1217
+ - sig/lib/mihari/mixins/rule.rbs
1218
+ - sig/lib/mihari/models/alert.rbs
1219
+ - sig/lib/mihari/models/artifact.rbs
1220
+ - sig/lib/mihari/models/autonomous_system.rbs
1221
+ - sig/lib/mihari/models/dns.rbs
1222
+ - sig/lib/mihari/models/geolocation.rbs
1223
+ - sig/lib/mihari/models/reverse_dns.rbs
1224
+ - sig/lib/mihari/models/tag.rbs
1225
+ - sig/lib/mihari/models/tagging.rbs
1226
+ - sig/lib/mihari/models/whois.rbs
1227
+ - sig/lib/mihari/notifiers/base.rbs
1228
+ - sig/lib/mihari/notifiers/exception_notifier.rbs
1229
+ - sig/lib/mihari/notifiers/slack.rbs
1230
+ - sig/lib/mihari/status.rbs
1231
+ - sig/lib/mihari/structs/censys.rbs
1232
+ - sig/lib/mihari/structs/onyphe.rbs
1233
+ - sig/lib/mihari/structs/shodan.rbs
1234
+ - sig/lib/mihari/type_checker.rbs
1235
+ - sig/lib/mihari/types.rbs
1236
+ - sig/lib/mihari/version.rbs
1237
+ - sig/lib/mihari/web/app.rbs
1006
1238
  homepage: https://github.com/ninoseki/mihari
1007
1239
  licenses:
1008
1240
  - MIT
@@ -1022,7 +1254,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1022
1254
  - !ruby/object:Gem::Version
1023
1255
  version: '0'
1024
1256
  requirements: []
1025
- rubygems_version: 3.2.15
1257
+ rubygems_version: 3.2.22
1026
1258
  signing_key:
1027
1259
  specification_version: 4
1028
1260
  summary: A framework for continuous OSINT based threat hunting