mihari 4.11.0 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (154) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +1 -1
  3. data/README.md +13 -3
  4. data/Steepfile +0 -1
  5. data/build_frontend.sh +0 -3
  6. data/docker/Dockerfile +11 -12
  7. data/images/Tines-Full_Logo-Tines_Black.png +0 -0
  8. data/lib/mihari/analyzers/base.rb +12 -28
  9. data/lib/mihari/analyzers/rule.rb +23 -36
  10. data/lib/mihari/cli/main.rb +6 -11
  11. data/lib/mihari/commands/initializer.rb +47 -0
  12. data/lib/mihari/commands/{search.rb → searcher.rb} +9 -20
  13. data/lib/mihari/commands/validator.rb +2 -2
  14. data/lib/mihari/commands/web.rb +4 -2
  15. data/lib/mihari/constants.rb +3 -3
  16. data/lib/mihari/database.rb +52 -87
  17. data/lib/mihari/emitters/database.rb +16 -7
  18. data/lib/mihari/emitters/misp.rb +13 -5
  19. data/lib/mihari/emitters/slack.rb +15 -8
  20. data/lib/mihari/emitters/the_hive.rb +42 -21
  21. data/lib/mihari/emitters/webhook.rb +99 -31
  22. data/lib/mihari/entities/alert.rb +7 -5
  23. data/lib/mihari/entities/artifact.rb +20 -8
  24. data/lib/mihari/entities/config.rb +2 -6
  25. data/lib/mihari/entities/rule.rb +8 -0
  26. data/lib/mihari/http.rb +13 -13
  27. data/lib/mihari/mixins/{disallowed_data_value.rb → falsepositive.rb} +8 -8
  28. data/lib/mihari/models/alert.rb +2 -15
  29. data/lib/mihari/models/artifact.rb +28 -17
  30. data/lib/mihari/models/rule.rb +7 -13
  31. data/lib/mihari/schemas/emitter.rb +6 -8
  32. data/lib/mihari/schemas/rule.rb +11 -13
  33. data/lib/mihari/structs/config.rb +41 -0
  34. data/lib/mihari/structs/filters.rb +2 -2
  35. data/lib/mihari/structs/rule.rb +96 -83
  36. data/lib/mihari/templates/rule.yml.erb +5 -23
  37. data/lib/mihari/types.rb +1 -1
  38. data/lib/mihari/version.rb +1 -1
  39. data/lib/mihari/web/api.rb +0 -2
  40. data/lib/mihari/web/app.rb +10 -4
  41. data/lib/mihari/web/endpoints/alerts.rb +11 -3
  42. data/lib/mihari/web/endpoints/configs.rb +1 -6
  43. data/lib/mihari/web/endpoints/rules.rb +27 -15
  44. data/lib/mihari/web/public/assets/{fa-brands-400.c7ae37d3.ttf → fa-brands-400-2ef6fdde.ttf} +0 -0
  45. data/lib/mihari/web/public/assets/fa-brands-400-f4617423.woff2 +0 -0
  46. data/lib/mihari/web/public/assets/fa-regular-400-12dea17b.ttf +0 -0
  47. data/lib/mihari/web/public/assets/fa-regular-400-7ba24c41.woff2 +0 -0
  48. data/lib/mihari/web/public/assets/fa-solid-900-67a880b4.ttf +0 -0
  49. data/lib/mihari/web/public/assets/fa-solid-900-e2c5cf54.woff2 +0 -0
  50. data/lib/mihari/web/public/assets/fa-v4compatibility-7c377405.woff2 +0 -0
  51. data/lib/mihari/web/public/assets/fa-v4compatibility-8d9500e8.ttf +0 -0
  52. data/lib/mihari/web/public/assets/{index.e1e67d84.css → index-625e95fe.css} +3 -3
  53. data/lib/mihari/web/public/assets/index-63900d73.js +50 -0
  54. data/lib/mihari/web/public/index.html +3 -3
  55. data/lib/mihari/web/public/redoc-static.html +26 -27
  56. data/lib/mihari.rb +11 -21
  57. data/mihari.gemspec +14 -14
  58. metadata +46 -131
  59. data/lib/mihari/cli/init.rb +0 -11
  60. data/lib/mihari/cli/validator.rb +0 -11
  61. data/lib/mihari/commands/init.rb +0 -51
  62. data/lib/mihari/emitters/http.rb +0 -127
  63. data/lib/mihari/entities/source.rb +0 -9
  64. data/lib/mihari/status.rb +0 -55
  65. data/lib/mihari/web/endpoints/sources.rb +0 -19
  66. data/lib/mihari/web/public/assets/fa-brands-400.3fe890d0.woff2 +0 -0
  67. data/lib/mihari/web/public/assets/fa-regular-400.fdc1f753.ttf +0 -0
  68. data/lib/mihari/web/public/assets/fa-regular-400.fe69d948.woff2 +0 -0
  69. data/lib/mihari/web/public/assets/fa-solid-900.6d53c706.ttf +0 -0
  70. data/lib/mihari/web/public/assets/fa-solid-900.d27bc752.woff2 +0 -0
  71. data/lib/mihari/web/public/assets/fa-v4compatibility.4d73f280.ttf +0 -0
  72. data/lib/mihari/web/public/assets/fa-v4compatibility.7d1c2ce5.woff2 +0 -0
  73. data/lib/mihari/web/public/assets/index.d3a61a69.js +0 -68
  74. data/sig/lib/mihari/analyzers/base.rbs +0 -90
  75. data/sig/lib/mihari/analyzers/binaryedge.rbs +0 -26
  76. data/sig/lib/mihari/analyzers/censys.rbs +0 -41
  77. data/sig/lib/mihari/analyzers/circl.rbs +0 -31
  78. data/sig/lib/mihari/analyzers/crtsh.rbs +0 -17
  79. data/sig/lib/mihari/analyzers/dnpedia.rbs +0 -15
  80. data/sig/lib/mihari/analyzers/dnstwister.rbs +0 -25
  81. data/sig/lib/mihari/analyzers/feed.rbs +0 -20
  82. data/sig/lib/mihari/analyzers/onyphe.rbs +0 -34
  83. data/sig/lib/mihari/analyzers/otx.rbs +0 -33
  84. data/sig/lib/mihari/analyzers/passivetotal.rbs +0 -35
  85. data/sig/lib/mihari/analyzers/pulsedive.rbs +0 -27
  86. data/sig/lib/mihari/analyzers/rule.rbs +0 -68
  87. data/sig/lib/mihari/analyzers/securitytrails.rbs +0 -33
  88. data/sig/lib/mihari/analyzers/shodan.rbs +0 -36
  89. data/sig/lib/mihari/analyzers/urlscan.rbs +0 -31
  90. data/sig/lib/mihari/analyzers/virustotal.rbs +0 -31
  91. data/sig/lib/mihari/analyzers/virustotal_intelligence.rbs +0 -33
  92. data/sig/lib/mihari/analyzers/zoomeye.rbs +0 -35
  93. data/sig/lib/mihari/cli/base.rbs +0 -9
  94. data/sig/lib/mihari/cli/init.rbs +0 -7
  95. data/sig/lib/mihari/cli/main.rbs +0 -9
  96. data/sig/lib/mihari/cli/validator.rbs +0 -7
  97. data/sig/lib/mihari/commands/init.rbs +0 -9
  98. data/sig/lib/mihari/commands/json.rbs +0 -7
  99. data/sig/lib/mihari/commands/search.rbs +0 -35
  100. data/sig/lib/mihari/commands/validator.rbs +0 -9
  101. data/sig/lib/mihari/commands/web.rbs +0 -7
  102. data/sig/lib/mihari/constants.rbs +0 -5
  103. data/sig/lib/mihari/database.rbs +0 -25
  104. data/sig/lib/mihari/emitters/base.rbs +0 -18
  105. data/sig/lib/mihari/emitters/database.rbs +0 -9
  106. data/sig/lib/mihari/emitters/http.rbs +0 -35
  107. data/sig/lib/mihari/emitters/misp.rbs +0 -34
  108. data/sig/lib/mihari/emitters/slack.rbs +0 -73
  109. data/sig/lib/mihari/emitters/stdout.rbs +0 -9
  110. data/sig/lib/mihari/emitters/the_hive.rbs +0 -32
  111. data/sig/lib/mihari/emitters/webhook.rbs +0 -20
  112. data/sig/lib/mihari/enrichers/base.rbs +0 -12
  113. data/sig/lib/mihari/enrichers/google_public_dns.rbs +0 -18
  114. data/sig/lib/mihari/enrichers/ipinfo.rbs +0 -16
  115. data/sig/lib/mihari/errors.rbs +0 -10
  116. data/sig/lib/mihari/feed/parser.rbs +0 -11
  117. data/sig/lib/mihari/feed/reader.rbs +0 -56
  118. data/sig/lib/mihari/http.rbs +0 -64
  119. data/sig/lib/mihari/mixins/autonomous_system.rbs +0 -14
  120. data/sig/lib/mihari/mixins/configurable.rbs +0 -30
  121. data/sig/lib/mihari/mixins/configuration.rbs +0 -45
  122. data/sig/lib/mihari/mixins/disallowed_data_value.rbs +0 -23
  123. data/sig/lib/mihari/mixins/error_notification.rbs +0 -12
  124. data/sig/lib/mihari/mixins/hash.rbs +0 -14
  125. data/sig/lib/mihari/mixins/refang.rbs +0 -14
  126. data/sig/lib/mihari/mixins/retriable.rbs +0 -15
  127. data/sig/lib/mihari/models/alert.rbs +0 -18
  128. data/sig/lib/mihari/models/artifact.rbs +0 -69
  129. data/sig/lib/mihari/models/autonomous_system.rbs +0 -14
  130. data/sig/lib/mihari/models/cpe.rbs +0 -7
  131. data/sig/lib/mihari/models/dns.rbs +0 -19
  132. data/sig/lib/mihari/models/geolocation.rbs +0 -15
  133. data/sig/lib/mihari/models/port.rbs +0 -7
  134. data/sig/lib/mihari/models/reverse_dns.rbs +0 -14
  135. data/sig/lib/mihari/models/rule.rbs +0 -17
  136. data/sig/lib/mihari/models/tag.rbs +0 -5
  137. data/sig/lib/mihari/models/tagging.rbs +0 -4
  138. data/sig/lib/mihari/models/whois.rbs +0 -66
  139. data/sig/lib/mihari/status.rbs +0 -25
  140. data/sig/lib/mihari/structs/censys.rbs +0 -58
  141. data/sig/lib/mihari/structs/filters.rbs +0 -40
  142. data/sig/lib/mihari/structs/google_public_dns.rbs +0 -21
  143. data/sig/lib/mihari/structs/greynoise.rbs +0 -30
  144. data/sig/lib/mihari/structs/ipinfo.rbs +0 -17
  145. data/sig/lib/mihari/structs/onyphe.rbs +0 -25
  146. data/sig/lib/mihari/structs/rule.rbs +0 -57
  147. data/sig/lib/mihari/structs/shodan.rbs +0 -30
  148. data/sig/lib/mihari/structs/urlscan.rbs +0 -28
  149. data/sig/lib/mihari/structs/virustotal_intelligence.rbs +0 -33
  150. data/sig/lib/mihari/type_checker.rbs +0 -48
  151. data/sig/lib/mihari/types.rbs +0 -23
  152. data/sig/lib/mihari/version.rbs +0 -3
  153. data/sig/lib/mihari/web/app.rbs +0 -5
  154. data/sig/lib/mihari.rbs +0 -54
@@ -1,9 +0,0 @@
1
- module Mihari
2
- module CLI
3
- class Main < Base
4
- include Mihari::Commands::Search
5
-
6
- include Mihari::Commands::Web
7
- end
8
- end
9
- end
@@ -1,7 +0,0 @@
1
- module Mihari
2
- module CLI
3
- class Validator < Base
4
- include Mihari::Commands::Validator
5
- end
6
- end
7
- end
@@ -1,9 +0,0 @@
1
- module Mihari
2
- module Commands
3
- module Initialization
4
- include Mixins::Rule
5
-
6
- def self.included: (untyped thor) -> untyped
7
- end
8
- end
9
- end
@@ -1,7 +0,0 @@
1
- module Mihari
2
- module Commands
3
- module JSON
4
- def self.included: (untyped thor) -> untyped
5
- end
6
- end
7
- end
@@ -1,35 +0,0 @@
1
- module Mihari
2
- module Commands
3
- module Search
4
- include Mixins::Rule
5
-
6
- def self.included: (untyped thor) -> untyped
7
-
8
- private
9
-
10
- #
11
- # Build a rule analyzer
12
- #
13
- # @param [String] title
14
- # @param [String] description
15
- # @param [Array<Hash>] queries
16
- # @param [Array<String>, nil] tags
17
- # @param [Array<String>, nil] allowed_data_types
18
- # @param [Array<String>, nil] disallowed_data_values
19
- # @param [String, nil] source
20
- #
21
- # @return [Mihari::Analyzers::Rule]
22
- #
23
- def build_rule_analyzer: (title: String title, description: String description, queries: Array[Hash[(String | Symbol), untyped]] queries, ?tags: Array[String]? tags, ?allowed_data_types: Array[String]? allowed_data_types, ?disallowed_data_values: Array[String]? disallowed_data_values, ?source: String? source, ?id: String? id) -> Mihari::Analyzers::Rule
24
-
25
- #
26
- # Run rule analyzer
27
- #
28
- # @param [Mihari::Analyzer::Rule] analyzer
29
- #
30
- # @return [nil]
31
- #
32
- def run_rule_analyzer: (Mihari::Analyzers::Rule analyzer, ?ignore_old_artifacts: bool ignore_old_artifacts, ?ignore_threshold: ::Integer ignore_threshold) -> untyped
33
- end
34
- end
35
- end
@@ -1,9 +0,0 @@
1
- module Mihari
2
- module Commands
3
- module Validator
4
- include Mixins::Rule
5
-
6
- def self.included: (untyped thor) -> untyped
7
- end
8
- end
9
- end
@@ -1,7 +0,0 @@
1
- module Mihari
2
- module Commands
3
- module Web
4
- def self.included: (untyped thor) -> untyped
5
- end
6
- end
7
- end
@@ -1,5 +0,0 @@
1
- module Mihari
2
- ALLOWED_DATA_TYPES: Array[String]
3
-
4
- DEFAULT_EMITTERS: Array[Hash]
5
- end
@@ -1,25 +0,0 @@
1
- class InitialSchema
2
- def change: () -> void
3
- end
4
-
5
- class AddeSourceToArtifactSchema
6
- def change: () -> void
7
- end
8
-
9
- class EnrichmentsSchema
10
- def change: () -> void
11
- end
12
-
13
- module Mihari
14
- class Database
15
- def self.connect: () -> void
16
-
17
- def self.close: () -> void
18
-
19
- def self.destroy!: () -> void
20
- end
21
- end
22
-
23
- class Object
24
- def adapter: () -> ("postgresql" | "mysql2" | "sqlite3")
25
- end
@@ -1,18 +0,0 @@
1
- module Mihari
2
- module Emitters
3
- class Base
4
- include Mixins::Configurable
5
-
6
- include Mixins::Retriable
7
-
8
- def self.inherited: (untyped child) -> untyped
9
-
10
- # @return [true, false]
11
- def valid?: () -> bool
12
-
13
- def run: (**untyped params) -> void
14
-
15
- def emit: () -> void
16
- end
17
- end
18
- end
@@ -1,9 +0,0 @@
1
- module Mihari
2
- module Emitters
3
- class Database < Base
4
- def valid?: () -> bool
5
-
6
- def emit: (title: String title, description: String description, artifacts: Array[Mihari::Artifact] artifacts, source: String source, ?tags: Array[String] tags) -> void
7
- end
8
- end
9
- end
@@ -1,35 +0,0 @@
1
- module Mihari
2
- module Emitters
3
- class PayloadTemplate < ERB
4
- def self.template: () -> ::String
5
-
6
- def initialize: (title: untyped title, description: untyped description, artifacts: untyped artifacts, source: untyped source, tags: untyped tags, ?options: ::Hash[untyped, untyped] options) -> void
7
-
8
- def result: () -> untyped
9
- end
10
-
11
- class HTTP < Base
12
- # @return [Addressable::URI, nil]
13
- attr_reader uri: Addressable::URI?
14
-
15
- # @return [Hash]
16
- attr_reader http_request_headers: Hash
17
-
18
- # @return [String]
19
- attr_reader http_request_method: String
20
-
21
- # @return [String, nil]
22
- attr_reader template: String?
23
-
24
- def initialize: (*untyped args, **untyped kwargs) -> void
25
-
26
- def emit: (title: String title, artifacts: Array[Mihari::Artifact] artifacts, ?tags: Array[String] tags, **untyped _options) -> void
27
-
28
- def valid?: () -> bool
29
-
30
- private
31
-
32
- def payload_as_string: (title: String title, description: String description, artifacts: Array[Mihari::Artifact] artifacts, source: String source, tags: Array[String] tags) -> String
33
- end
34
- end
35
- end
@@ -1,34 +0,0 @@
1
- module Mihari
2
- module Emitters
3
- class MISP < Base
4
-
5
- attr_reader url: String?
6
-
7
- attr_reader api_key: String?
8
-
9
-
10
- def initialize: () -> void
11
-
12
- # @return [true, false]
13
- def valid?: () -> bool
14
-
15
- def emit: (title: String title, artifacts: Array[Mihari::Artifact] artifacts, ?tags: Array[String] tags, **untyped _options) -> void
16
-
17
- private
18
-
19
- def configuration_keys: () -> ::Array["misp_url" | "misp_api_key"]
20
-
21
- def build_attribute: (Mihari::Artifact artifact) -> untyped
22
-
23
- def hash_type: (String value) -> String?
24
-
25
- def to_misp_type: (type: String `type`, value: String value) -> String?
26
-
27
- def url?: () -> bool
28
-
29
- def api_key?: () -> bool
30
-
31
- def ping?: () -> bool
32
- end
33
- end
34
- end
@@ -1,73 +0,0 @@
1
- module Mihari
2
- module Emitters
3
- class Attachment
4
- attr_reader data: String
5
- attr_reader data_type: String
6
-
7
- # extend Dry::Initializer
8
-
9
- def actions: () -> Array[Hash[(String | Symbol), untyped]]
10
-
11
- def vt_link: () -> (nil | { :type => "button", text: "VirusTotal", url: String })
12
-
13
- def urlscan_link: () -> (nil | { :type => "button", text: "urlscan.io", url: String })
14
-
15
- def censys_link: () -> (nil | { :type => "button", text: "Censys", url: String })
16
-
17
- def shodan_link: () -> (nil | { :type => "button", text: "Shodan", url: String })
18
-
19
- # @return [Array]
20
- def to_a: () -> ::Array[{ text: String, fallback: "VT & urlscan.io links", actions: Array[Hash[(String | Symbol), untyped]] }]
21
-
22
- private
23
-
24
- # @return [String]
25
- def _urlscan_link: () -> String?
26
-
27
- # @return [String]
28
- def _vt_link: () -> String?
29
-
30
- def _censys_link: () -> String?
31
-
32
- def _shodan_link: () -> String?
33
-
34
- # @return [String]
35
- def sha256: () -> String
36
-
37
- # @return [String]
38
- def defanged_data: () -> String
39
- end
40
-
41
- class Slack < Base
42
- DEFAULT_CHANNEL: String
43
-
44
- DEFAULT_USERNAME: String
45
-
46
- # @return [String, nil]
47
- attr_reader webhook_url: String?
48
-
49
- # @return [String]
50
- attr_reader channel: String
51
-
52
- # @return [String]
53
- attr_reader username: String
54
-
55
- #
56
- # Check webhook URL is set
57
- #
58
- # @return [Boolean]
59
- #
60
- def webhook_url?: () -> bool
61
-
62
- def notifier: () -> ::Slack::Notifier
63
-
64
- def valid?: () -> bool
65
-
66
- def to_attachments: (Array[Mihari::Artifact] artifacts) -> Array[Mihari::Emitters::Attachment]
67
-
68
- def to_text: (title: String title, description: String description, ?tags: Array[String] tags) -> String
69
-
70
- def emit: (title: String title, description: String description, artifacts: Array[Mihari::Artifact] artifacts, ?tags: Array[String] tags, **untyped _options) -> void
71
- end
72
- end
73
- end
@@ -1,9 +0,0 @@
1
- module Mihari
2
- module Emitters
3
- class StandardOutput < Base
4
- def valid?: () -> ::TrueClass
5
-
6
- def emit: (title: String title, description: String description, artifacts: Array[Mihari::Artifact] artifacts, source: String source, tags: Array[String] tags) -> void
7
- end
8
- end
9
- end
@@ -1,32 +0,0 @@
1
- module Mihari
2
- module Emitters
3
- class TheHive < Base
4
- attr_reader url: String?
5
-
6
- attr_reader api_key: String?
7
-
8
- attr_reader api_version: String?
9
-
10
- # @return [true, false]
11
- def valid?: () -> bool
12
-
13
- def emit: (title: untyped title, description: untyped description, artifacts: untyped artifacts, ?tags: untyped tags, **untyped _options) -> (nil | untyped)
14
-
15
- def normalized_api_version: () -> String?
16
-
17
- private
18
-
19
- def configuration_keys: () -> ::Array["thehive_url" | "thehive_api_key"]
20
-
21
- def api: () -> untyped
22
-
23
- # @return [true, false]
24
- def url?: () -> bool
25
-
26
- # @return [true, false]
27
- def api_key?: () -> bool
28
-
29
- def ping?: () -> bool
30
- end
31
- end
32
- end
@@ -1,20 +0,0 @@
1
- module Mihari
2
- module Emitters
3
- class Webhook < Base
4
- # @return [true, false]
5
- def valid?: () -> bool
6
-
7
- def emit: (title: String title, description: String description, artifacts: Array[Mihari::Artifact] artifacts, source: String source, tags: Array[String] tags) -> void
8
-
9
- private
10
-
11
- def configuration_keys: () -> ::Array["webhook_url"]
12
-
13
- def webhook_url: () -> String?
14
-
15
- def webhook_url?: () -> bool
16
-
17
- def use_json_body?: () -> bool?
18
- end
19
- end
20
- end
@@ -1,12 +0,0 @@
1
- module Mihari
2
- module Enrichers
3
- class Base
4
- include Mixins::Configurable
5
-
6
- def self.inherited: (untyped child) -> untyped
7
-
8
- # @return [Boolean]
9
- def valid?: () -> bool
10
- end
11
- end
12
- end
@@ -1,18 +0,0 @@
1
- module Mihari
2
- module Enrichers
3
- class GooglePublicDNS < Base
4
- # @return [Boolean]
5
- def valid?: () -> true
6
-
7
- #
8
- # Query Google Public DNS
9
- #
10
- # @param [String] name
11
- # @param [String] resource_type
12
- #
13
- # @return [Mihari::Structs::Shodan::GooglePublicDNS::Response, nil]
14
- #
15
- def self.query: (String name, String resource_type) -> Mihari::Structs::Shodan::GooglePublicDNS::Response?
16
- end
17
- end
18
- end
@@ -1,16 +0,0 @@
1
- module Mihari
2
- module Enrichers
3
- class IPInfo
4
- def valid?: () -> bool
5
-
6
- #
7
- # Query IPInfo
8
- #
9
- # @param [String] ip
10
- #
11
- # @return [Mihari::Structs::IPInfo::Response, nil]
12
- #
13
- def self.query: (String ip) -> Mihari::Structs::IPInfo::Response?
14
- end
15
- end
16
- end
@@ -1,10 +0,0 @@
1
- module Mihari
2
- class Error < StandardError
3
- end
4
-
5
- class InvalidInputError < Error
6
- end
7
-
8
- class RetryableError < Error
9
- end
10
- end
@@ -1,11 +0,0 @@
1
- module Mihari
2
- module Feed
3
- class Parser
4
- attr_reader data: Array[Hash] | Array[Array[String]]
5
-
6
- def initialize: (Array[Hash] | Array[Array[String]] data) -> void
7
-
8
- def parse: (String selector) -> Array[String]
9
- end
10
- end
11
- end
@@ -1,56 +0,0 @@
1
- module Mihari
2
- class FeedReader
3
- attr_reader uri: URI
4
-
5
- attr_reader http_request_headers: Hash[(String | Symbol), untyped]
6
-
7
- attr_reader http_request_method: String
8
-
9
- attr_reader http_request_payload_type: String?
10
-
11
- attr_reader http_request_payload: Hash[(String | Symbol), untyped]
12
-
13
- def initialize: (
14
- String uri,
15
- ?http_request_headers: Hash[(String | Symbol), untyped] http_request_headers,
16
- ?http_request_method: String http_request_method,
17
- ?http_request_payload_type: String? http_request_payload_type,
18
- ?http_request_payload: Hash[(String | Symbol), untyped] http_request_payload
19
- ) -> void
20
-
21
- def read: () -> Array[Hash]
22
-
23
- def get: () -> Array[Hash]
24
-
25
- def post: () -> Array[Hash]
26
-
27
- #
28
- # Convert text as JSON
29
- #
30
- # @param [String] text
31
- #
32
- # @return [Array<Hash>]
33
- #
34
- def convert_as_json: (String text) -> Array[Hash]
35
-
36
- #
37
- # Convert text as CSV
38
- #
39
- # @param [String] text
40
- #
41
- # @return [Array<Hash>]
42
- #
43
- def convert_as_csv: (String text) -> Array[Hash]
44
-
45
- def https_options: () -> ({ use_ssl: ::TrueClass } | ::Hash[untyped, untyped])
46
-
47
- #
48
- # Make a HTTP request
49
- #
50
- # @param [Net::HTTPRequest] req
51
- #
52
- # @return [Array<Hash>]
53
- #
54
- def request: (Net::HTTPRequest req) -> Array[Hash]
55
- end
56
- end
@@ -1,64 +0,0 @@
1
-
2
- module Mihari
3
- class HTTP
4
- attr_reader uri: URI
5
-
6
- attr_reader headers: Hash[(String | Symbol), untyped]
7
-
8
- attr_reader payload: Hash[(String | Symbol), untyped]
9
-
10
- def initialize: (
11
- String uri,
12
- ?headers: Hash[(String | Symbol), untyped] headers,
13
- ?payload: Hash[(String | Symbol), untyped] payload
14
- ) -> void
15
-
16
- #
17
- # Make a GET request
18
- #
19
- # @return [Net::HTTPResponse]
20
- #
21
- def get: () -> Net::HTTPResponse
22
-
23
- #
24
- # Make a POST request
25
- #
26
- # @return [Net::HTTPResponse]
27
- #
28
- def post: () -> Net::HTTPResponse
29
-
30
- def self.get: (
31
- String uri,
32
- ?headers: Hash[(String | Symbol), untyped] headers,
33
- ?payload_type: String? payload_type,
34
- ?payload: Hash[(String | Symbol), untyped] payload
35
- ) -> Net::HTTPResponse
36
-
37
- def self.post: (
38
- String uri,
39
- ?headers: Hash[(String | Symbol), untyped] headers,
40
- ?payload_type: String? payload_type,
41
- ?payload: Hash[(String | Symbol), untyped] payload
42
- ) -> Net::HTTPResponse
43
-
44
- private
45
-
46
- def content_type: () -> String
47
-
48
- #
49
- # Get options for HTTP request
50
- #
51
- # @return [Hahs]
52
- #
53
- def https_options: () -> ({ use_ssl: ::TrueClass } | ::Hash[untyped, untyped])
54
-
55
- #
56
- # Make a HTTP request
57
- #
58
- # @param [Net::HTTPRequest] req
59
- #
60
- # @return [Net::HTTPResponse]
61
- #
62
- def request: (untyped req) -> Net::HTTPResponse
63
- end
64
- end
@@ -1,14 +0,0 @@
1
- module Mihari
2
- module Mixins
3
- module AutonomousSystem
4
- #
5
- # Normalize ASN value
6
- #
7
- # @param [String, Integer] asn
8
- #
9
- # @return [Integer]
10
- #
11
- def normalize_asn: (String | Integer asn) -> Integer
12
- end
13
- end
14
- end
@@ -1,30 +0,0 @@
1
- module Mihari
2
- module Mixins
3
- module Configurable
4
- #
5
- # Check whether it is configured or not
6
- #
7
- # @return [Boolean]
8
- #
9
- def configured?: () -> bool
10
-
11
- private
12
-
13
- #
14
- # Configuration values
15
- #
16
- # @return [Array<Hash>, nil] Configuration values as a list of hash. Returns nil if there is any keys.
17
- #
18
- def configuration_values: () -> untyped
19
-
20
- #
21
- # Configuration keys
22
- #
23
- # @return [Array<String>] A list of cofiguration keys
24
- #
25
- def configuration_keys: () -> Array[String]
26
-
27
- def api_key?: () -> bool
28
- end
29
- end
30
- end
@@ -1,45 +0,0 @@
1
- module Mihari
2
- module Mixins
3
- module Configuration
4
- #
5
- # Load config file into hash
6
- #
7
- # @param [String] path Path to YAML file
8
- #
9
- # @return [Hash]
10
- #
11
- def load_config: (String path) -> Hash
12
-
13
- #
14
- # Validate config schema
15
- #
16
- # @param [Hash] config
17
- #
18
- def validate_config: (Hash config) -> void
19
-
20
- #
21
- # Returns a template for config
22
- #
23
- # @return [String] A template for config
24
- #
25
- def config_template: () -> String
26
-
27
- #
28
- # Create (blank) config file
29
- #
30
- # @param [String] filename
31
- # @param [Dry::Files] files
32
- # @param [String] template
33
- #
34
- # @return [nil]
35
- #
36
- def initialize_config_yaml: (String filename, ?untyped files, ?template: String template) -> nil
37
-
38
- private
39
-
40
- def show_validation_errors: (untyped errors) -> void
41
-
42
- def _load_config: (String path) -> untyped
43
- end
44
- end
45
- end
@@ -1,23 +0,0 @@
1
- module Mihari
2
- module Mixins
3
- module DisallowedDataValue
4
- #
5
- # Normalize a value as a disallowed data value
6
- #
7
- # @param [String] value Data value
8
- #
9
- # @return [String, Regexp] Normalized value
10
- #
11
- def normalize_disallowed_data_value: (String value) -> (String | Regexp)
12
-
13
- #
14
- # Check whetehr a value is valid format as a disallowed data value
15
- #
16
- # @param [String] value Data value
17
- #
18
- # @return [Boolean] true if it is valid, otherwise false
19
- #
20
- def valid_disallowed_data_value?: (String value) -> bool
21
- end
22
- end
23
- end