mihari 7.3.2 → 7.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +8 -0
  3. data/.rubocop.yml +0 -2
  4. data/.shadowenv.d/.gitignore +2 -0
  5. data/.shadowenv.d/000_unset_all.lisp +39 -0
  6. data/README.md +0 -8
  7. data/lib/mihari/analyzers/base.rb +2 -2
  8. data/lib/mihari/analyzers/binaryedge.rb +5 -5
  9. data/lib/mihari/analyzers/censys.rb +6 -6
  10. data/lib/mihari/analyzers/circl.rb +2 -2
  11. data/lib/mihari/analyzers/crtsh.rb +3 -3
  12. data/lib/mihari/analyzers/dnstwister.rb +2 -2
  13. data/lib/mihari/analyzers/feed.rb +12 -18
  14. data/lib/mihari/analyzers/fofa.rb +6 -6
  15. data/lib/mihari/analyzers/greynoise.rb +5 -5
  16. data/lib/mihari/analyzers/hunterhow.rb +4 -4
  17. data/lib/mihari/analyzers/onyphe.rb +5 -5
  18. data/lib/mihari/analyzers/otx.rb +2 -2
  19. data/lib/mihari/analyzers/passivetotal.rb +3 -3
  20. data/lib/mihari/analyzers/pulsedive.rb +3 -3
  21. data/lib/mihari/analyzers/securitytrails.rb +4 -4
  22. data/lib/mihari/analyzers/shodan.rb +5 -5
  23. data/lib/mihari/analyzers/urlscan.rb +5 -5
  24. data/lib/mihari/analyzers/virustotal.rb +4 -4
  25. data/lib/mihari/analyzers/virustotal_intelligence.rb +5 -5
  26. data/lib/mihari/analyzers/zoomeye.rb +5 -5
  27. data/lib/mihari/cli/application.rb +1 -1
  28. data/lib/mihari/clients/base.rb +7 -6
  29. data/lib/mihari/clients/binaryedge.rb +6 -6
  30. data/lib/mihari/clients/censys.rb +4 -4
  31. data/lib/mihari/clients/circl.rb +2 -2
  32. data/lib/mihari/clients/crtsh.rb +2 -2
  33. data/lib/mihari/clients/dnstwister.rb +1 -1
  34. data/lib/mihari/clients/fofa.rb +4 -4
  35. data/lib/mihari/clients/google_public_dns.rb +2 -2
  36. data/lib/mihari/clients/greynoise.rb +4 -4
  37. data/lib/mihari/clients/hunterhow.rb +10 -10
  38. data/lib/mihari/clients/misp.rb +1 -1
  39. data/lib/mihari/clients/mmdb.rb +1 -1
  40. data/lib/mihari/clients/onyphe.rb +4 -4
  41. data/lib/mihari/clients/otx.rb +1 -1
  42. data/lib/mihari/clients/passivetotal.rb +5 -5
  43. data/lib/mihari/clients/publsedive.rb +3 -3
  44. data/lib/mihari/clients/securitytrails.rb +6 -6
  45. data/lib/mihari/clients/shodan.rb +6 -6
  46. data/lib/mihari/clients/shodan_internet_db.rb +1 -1
  47. data/lib/mihari/clients/the_hive.rb +2 -2
  48. data/lib/mihari/clients/urlscan.rb +4 -4
  49. data/lib/mihari/clients/virustotal.rb +4 -4
  50. data/lib/mihari/clients/whois.rb +118 -0
  51. data/lib/mihari/clients/yeti.rb +38 -0
  52. data/lib/mihari/clients/zoomeye.rb +12 -12
  53. data/lib/mihari/commands/alert.rb +1 -1
  54. data/lib/mihari/commands/artifact.rb +1 -1
  55. data/lib/mihari/commands/rule.rb +1 -1
  56. data/lib/mihari/commands/tag.rb +1 -1
  57. data/lib/mihari/concerns/autonomous_system_normalizable.rb +1 -4
  58. data/lib/mihari/concerns/configurable.rb +1 -1
  59. data/lib/mihari/concerns/database_connectable.rb +2 -2
  60. data/lib/mihari/concerns/retriable.rb +1 -1
  61. data/lib/mihari/config.rb +14 -2
  62. data/lib/mihari/constants.rb +2 -2
  63. data/lib/mihari/data_type.rb +1 -3
  64. data/lib/mihari/emitters/base.rb +2 -2
  65. data/lib/mihari/emitters/database.rb +1 -1
  66. data/lib/mihari/emitters/misp.rb +12 -4
  67. data/lib/mihari/emitters/slack.rb +9 -9
  68. data/lib/mihari/emitters/the_hive.rb +9 -4
  69. data/lib/mihari/emitters/webhook.rb +4 -4
  70. data/lib/mihari/emitters/yeti.rb +107 -0
  71. data/lib/mihari/enrichers/base.rb +1 -1
  72. data/lib/mihari/enrichers/google_public_dns.rb +1 -1
  73. data/lib/mihari/enrichers/mmdb.rb +1 -1
  74. data/lib/mihari/enrichers/shodan.rb +3 -3
  75. data/lib/mihari/enrichers/whois.rb +6 -91
  76. data/lib/mihari/entities/alert.rb +6 -6
  77. data/lib/mihari/entities/artifact.rb +17 -17
  78. data/lib/mihari/entities/autonomous_system.rb +1 -1
  79. data/lib/mihari/entities/config.rb +8 -4
  80. data/lib/mihari/entities/cpe.rb +2 -2
  81. data/lib/mihari/entities/dns.rb +3 -3
  82. data/lib/mihari/entities/geolocation.rb +3 -3
  83. data/lib/mihari/entities/ip_address.rb +3 -3
  84. data/lib/mihari/entities/messages.rb +3 -3
  85. data/lib/mihari/entities/pagination.rb +3 -3
  86. data/lib/mihari/entities/port.rb +2 -2
  87. data/lib/mihari/entities/reverse_dns.rb +2 -2
  88. data/lib/mihari/entities/rule.rb +8 -8
  89. data/lib/mihari/entities/tag.rb +3 -3
  90. data/lib/mihari/entities/vulnerability.rb +2 -2
  91. data/lib/mihari/entities/whois.rb +7 -7
  92. data/lib/mihari/errors.rb +1 -1
  93. data/lib/mihari/models/artifact.rb +2 -2
  94. data/lib/mihari/models/port.rb +1 -1
  95. data/lib/mihari/models/tag.rb +3 -0
  96. data/lib/mihari/rule.rb +10 -14
  97. data/lib/mihari/schemas/emitter.rb +9 -0
  98. data/lib/mihari/services/feed.rb +3 -3
  99. data/lib/mihari/services/getters.rb +1 -1
  100. data/lib/mihari/services/proxies.rb +1 -1
  101. data/lib/mihari/services/renderer.rb +2 -0
  102. data/lib/mihari/services/searchers.rb +1 -1
  103. data/lib/mihari/sidekiq/application.rb +2 -2
  104. data/lib/mihari/structs/censys.rb +4 -4
  105. data/lib/mihari/structs/google_public_dns.rb +3 -3
  106. data/lib/mihari/structs/greynoise.rb +2 -2
  107. data/lib/mihari/structs/onyphe.rb +3 -3
  108. data/lib/mihari/structs/shodan.rb +10 -10
  109. data/lib/mihari/structs/urlscan.rb +1 -1
  110. data/lib/mihari/structs/virustotal_intelligence.rb +2 -2
  111. data/lib/mihari/version.rb +1 -1
  112. data/lib/mihari/web/api.rb +1 -1
  113. data/lib/mihari/web/application.rb +1 -1
  114. data/lib/mihari/web/endpoints/alerts.rb +12 -12
  115. data/lib/mihari/web/endpoints/artifacts.rb +11 -11
  116. data/lib/mihari/web/endpoints/configs.rb +7 -2
  117. data/lib/mihari/web/endpoints/ip_addresses.rb +5 -5
  118. data/lib/mihari/web/endpoints/rules.rb +26 -26
  119. data/lib/mihari/web/endpoints/tags.rb +4 -4
  120. data/lib/mihari/web/public/assets/{index-ReF8ffd-.css → index-80oZkhZG.css} +1 -1
  121. data/lib/mihari/web/public/assets/index-BNLbw8nG.js +1783 -0
  122. data/lib/mihari/web/public/index.html +2 -2
  123. data/lib/mihari/web/public/redoc-static.html +2 -2
  124. data/lib/mihari.rb +4 -1
  125. data/mihari.gemspec +19 -19
  126. data/renovate.json +1 -3
  127. data/requirements.txt +1 -1
  128. metadata +48 -44
  129. data/.standard.yml +0 -4
  130. data/lib/mihari/web/public/assets/index-lRP933ks.js +0 -1787
  131. /data/lib/mihari/web/public/assets/{mode-yaml-BC4MIiYj.js → mode-yaml-ELgwiJiP.js} +0 -0
@@ -55,7 +55,7 @@ module Mihari
55
55
 
56
56
  def safe_execute
57
57
  yield
58
- rescue StandardError => e
58
+ rescue => e
59
59
  error = unwrap_error(e)
60
60
 
61
61
  # Raise error if it's a Thor::Error to follow Thor's manner
@@ -41,7 +41,7 @@ module Mihari
41
41
  # @return [::HTTP::Client]
42
42
  #
43
43
  def http
44
- @http ||= HTTP::Factory.build(headers: headers, timeout: timeout)
44
+ @http ||= HTTP::Factory.build(headers:, timeout:)
45
45
  end
46
46
 
47
47
  #
@@ -60,7 +60,7 @@ module Mihari
60
60
  # @return [::HTTP::Response]
61
61
  #
62
62
  def get(path, params: nil)
63
- http.get(url_for(path), params: params)
63
+ http.get(url_for(path), params:)
64
64
  end
65
65
 
66
66
  #
@@ -70,7 +70,7 @@ module Mihari
70
70
  # @return [Hash]
71
71
  #
72
72
  def get_json(path, params: nil)
73
- res = get(path, params: params)
73
+ res = get(path, params:)
74
74
  JSON.parse res.body.to_s
75
75
  end
76
76
 
@@ -81,17 +81,18 @@ module Mihari
81
81
  # @return [::HTTP::Response]
82
82
  #
83
83
  def post(path, json: {})
84
- http.post(url_for(path), json: json)
84
+ http.post(url_for(path), json:)
85
85
  end
86
86
 
87
87
  #
88
88
  # @param [String] path
89
89
  # @param [Hash, nil] json
90
+ # @param [Hash, nil] headers
90
91
  #
91
92
  # @return [Hash]
92
93
  #
93
- def post_json(path, json: {})
94
- res = http.post(url_for(path), json: json)
94
+ def post_json(path, json: {}, headers: nil)
95
+ res = http.post(url_for(path), json:, headers: headers || {})
95
96
  JSON.parse res.body.to_s
96
97
  end
97
98
  end
@@ -22,7 +22,7 @@ module Mihari
22
22
  )
23
23
  headers["x-key"] = api_key
24
24
 
25
- super(base_url, headers: headers, timeout: timeout, pagination_interval: pagination_interval)
25
+ super(base_url, headers:, timeout:, pagination_interval:)
26
26
  end
27
27
 
28
28
  #
@@ -34,11 +34,11 @@ module Mihari
34
34
  #
35
35
  def search(query, page: 1, only_ips: nil)
36
36
  params = {
37
- query: query,
38
- page: page,
39
- only_ips: only_ips
37
+ query:,
38
+ page:,
39
+ only_ips:
40
40
  }.compact
41
- Structs::BinaryEdge::Response.from_dynamic! get_json("/v2/query/search", params: params)
41
+ Structs::BinaryEdge::Response.from_dynamic! get_json("/v2/query/search", params:)
42
42
  end
43
43
 
44
44
  #
@@ -51,7 +51,7 @@ module Mihari
51
51
  def search_with_pagination(query, only_ips: nil, pagination_limit: Mihari.config.pagination_limit)
52
52
  Enumerator.new do |y|
53
53
  (1..pagination_limit).each do |page|
54
- res = search(query, page: page, only_ips: only_ips)
54
+ res = search(query, page:, only_ips:)
55
55
 
56
56
  y.yield res
57
57
 
@@ -29,7 +29,7 @@ module Mihari
29
29
 
30
30
  headers["authorization"] = "Basic #{Base64.strict_encode64("#{id}:#{secret}")}"
31
31
 
32
- super(base_url, headers: headers, pagination_interval: pagination_interval, timeout: timeout)
32
+ super(base_url, headers:, pagination_interval:, timeout:)
33
33
  end
34
34
 
35
35
  #
@@ -45,8 +45,8 @@ module Mihari
45
45
  # @return [Mihari::Structs::Censys::Response]
46
46
  #
47
47
  def search(query, per_page: nil, cursor: nil)
48
- params = { q: query, per_page: per_page, cursor: cursor }.compact
49
- Structs::Censys::Response.from_dynamic! get_json("/api/v2/hosts/search", params: params)
48
+ params = {q: query, per_page:, cursor:}.compact
49
+ Structs::Censys::Response.from_dynamic! get_json("/api/v2/hosts/search", params:)
50
50
  end
51
51
 
52
52
  #
@@ -61,7 +61,7 @@ module Mihari
61
61
 
62
62
  Enumerator.new do |y|
63
63
  pagination_limit.times do
64
- res = search(query, per_page: per_page, cursor: cursor)
64
+ res = search(query, per_page:, cursor:)
65
65
 
66
66
  y.yield res
67
67
 
@@ -21,7 +21,7 @@ module Mihari
21
21
 
22
22
  headers["authorization"] = "Basic #{Base64.strict_encode64("#{username}:#{password}")}"
23
23
 
24
- super(base_url, headers: headers, timeout: timeout)
24
+ super(base_url, headers:, timeout:)
25
25
  end
26
26
 
27
27
  #
@@ -77,7 +77,7 @@ module Mihari
77
77
  # @param [Hash] params
78
78
  #
79
79
  def _get(path, params: {})
80
- res = get(path, params: params)
80
+ res = get(path, params:)
81
81
  body = res.body.to_s
82
82
  content_type = res["Content-Type"].to_s
83
83
 
@@ -12,7 +12,7 @@ module Mihari
12
12
  # @param [Integer, nil] timeout
13
13
  #
14
14
  def initialize(base_url = "https://crt.sh", headers: {}, timeout: nil)
15
- super(base_url, headers: headers, timeout: timeout)
15
+ super(base_url, headers:, timeout:)
16
16
  end
17
17
 
18
18
  #
@@ -25,7 +25,7 @@ module Mihari
25
25
  # @return [Array<Hash>]
26
26
  #
27
27
  def search(identity, match: nil, exclude: nil)
28
- get_json("/", params: { identity: identity, match: match, exclude: exclude, output: "json" }.compact)
28
+ get_json("/", params: {identity:, match:, exclude:, output: "json"}.compact)
29
29
  end
30
30
  end
31
31
  end
@@ -12,7 +12,7 @@ module Mihari
12
12
  # @param [Integer, nil] timeout
13
13
  #
14
14
  def initialize(base_url = "https://dnstwister.report", headers: {}, timeout: nil)
15
- super(base_url, headers: headers, timeout: timeout)
15
+ super(base_url, headers:, timeout:)
16
16
  end
17
17
 
18
18
  #
@@ -39,7 +39,7 @@ module Mihari
39
39
  @api_key = api_key
40
40
  @email = email
41
41
 
42
- super(base_url, headers: headers, pagination_interval: pagination_interval, timeout: timeout)
42
+ super(base_url, headers:, pagination_interval:, timeout:)
43
43
  end
44
44
 
45
45
  #
@@ -51,8 +51,8 @@ module Mihari
51
51
  #
52
52
  def search(query, page:, size: PAGE_SIZE)
53
53
  qbase64 = Base64.urlsafe_encode64(query)
54
- params = { qbase64: qbase64, size: size, page: page, email: email, key: api_key }.compact
55
- res = Structs::Fofa::Response.from_dynamic!(get_json("/api/v1/search/all", params: params))
54
+ params = {qbase64:, size:, page:, email:, key: api_key}.compact
55
+ res = Structs::Fofa::Response.from_dynamic!(get_json("/api/v1/search/all", params:))
56
56
  raise ResponseError, res.errmsg if res.error
57
57
 
58
58
  res
@@ -68,7 +68,7 @@ module Mihari
68
68
  def search_with_pagination(query, size: PAGE_SIZE, pagination_limit: Mihari.config.pagination_limit)
69
69
  Enumerator.new do |y|
70
70
  (1..pagination_limit).each do |page|
71
- res = search(query, page: page, size: size)
71
+ res = search(query, page:, size:)
72
72
 
73
73
  y.yield res
74
74
 
@@ -12,7 +12,7 @@ module Mihari
12
12
  # @param [Integer, nil] timeout
13
13
  #
14
14
  def initialize(base_url = "https://dns.google", headers: {}, timeout: nil)
15
- super(base_url, headers: headers, timeout: timeout)
15
+ super(base_url, headers:, timeout:)
16
16
  end
17
17
 
18
18
  #
@@ -24,7 +24,7 @@ module Mihari
24
24
  #
25
25
  def query_all(name)
26
26
  Structs::GooglePublicDNS::Response.from_dynamic! get_json("/resolve",
27
- params: { name: name, type: "ALL" })
27
+ params: {name:, type: "ALL"})
28
28
  end
29
29
  end
30
30
  end
@@ -25,7 +25,7 @@ module Mihari
25
25
  raise(ArgumentError, "api_key is required") unless api_key
26
26
 
27
27
  headers["key"] = api_key
28
- super(base_url, headers: headers, pagination_interval: pagination_interval, timeout: timeout)
28
+ super(base_url, headers:, pagination_interval:, timeout:)
29
29
  end
30
30
 
31
31
  #
@@ -38,8 +38,8 @@ module Mihari
38
38
  # @return [Mihari::Structs::GreyNoise::Response]
39
39
  #
40
40
  def gnql_search(query, size: PAGE_SIZE, scroll: nil)
41
- params = { query: query, size: size, scroll: scroll }.compact
42
- Structs::GreyNoise::Response.from_dynamic! get_json("/v2/experimental/gnql", params: params)
41
+ params = {query:, size:, scroll:}.compact
42
+ Structs::GreyNoise::Response.from_dynamic! get_json("/v2/experimental/gnql", params:)
43
43
  end
44
44
 
45
45
  #
@@ -54,7 +54,7 @@ module Mihari
54
54
 
55
55
  Enumerator.new do |y|
56
56
  pagination_limit.times do
57
- res = gnql_search(query, size: size, scroll: scroll)
57
+ res = gnql_search(query, size:, scroll:)
58
58
 
59
59
  y.yield res
60
60
 
@@ -29,7 +29,7 @@ module Mihari
29
29
  )
30
30
  raise(ArgumentError, "api_key is required") unless api_key
31
31
 
32
- super(base_url, headers: headers, pagination_interval: pagination_interval, timeout: timeout)
32
+ super(base_url, headers:, pagination_interval:, timeout:)
33
33
 
34
34
  @api_key = api_key
35
35
  end
@@ -46,13 +46,13 @@ module Mihari
46
46
  def search(query, start_time:, end_time:, page: 1, page_size: PAGE_SIZE)
47
47
  params = {
48
48
  query: Base64.urlsafe_encode64(query),
49
- page: page,
50
- page_size: page_size,
51
- start_time: start_time,
52
- end_time: end_time,
49
+ page:,
50
+ page_size:,
51
+ start_time:,
52
+ end_time:,
53
53
  "api-key": api_key
54
54
  }.compact
55
- Structs::HunterHow::Response.from_dynamic! get_json("/search", params: params)
55
+ Structs::HunterHow::Response.from_dynamic! get_json("/search", params:)
56
56
  end
57
57
 
58
58
  #
@@ -75,10 +75,10 @@ module Mihari
75
75
  (1..pagination_limit).each do |page|
76
76
  res = search(
77
77
  query,
78
- start_time: start_time,
79
- end_time: end_time,
80
- page: page,
81
- page_size: page_size
78
+ start_time:,
79
+ end_time:,
80
+ page:,
81
+ page_size:
82
82
  )
83
83
 
84
84
  y.yield res
@@ -18,7 +18,7 @@ module Mihari
18
18
  headers["authorization"] = api_key
19
19
  headers["accept"] = "application/json"
20
20
 
21
- super(base_url, headers: headers, timeout: timeout)
21
+ super(base_url, headers:, timeout:)
22
22
  end
23
23
 
24
24
  #
@@ -12,7 +12,7 @@ module Mihari
12
12
  # @param [Integer, nil] timeout
13
13
  #
14
14
  def initialize(base_url = "https://ip.circl.lu", headers: {}, timeout: nil)
15
- super(base_url, headers: headers, timeout: timeout)
15
+ super(base_url, headers:, timeout:)
16
16
  end
17
17
 
18
18
  #
@@ -27,7 +27,7 @@ module Mihari
27
27
  )
28
28
  raise(ArgumentError, "api_key is required") if api_key.nil?
29
29
 
30
- super(base_url, headers: headers, pagination_interval: pagination_interval, timeout: timeout)
30
+ super(base_url, headers:, pagination_interval:, timeout:)
31
31
 
32
32
  @api_key = api_key
33
33
  end
@@ -39,8 +39,8 @@ module Mihari
39
39
  # @return [Mihari::Structs::Onyphe::Response]
40
40
  #
41
41
  def datascan(query, page: 1)
42
- params = { page: page, apikey: api_key }
43
- Structs::Onyphe::Response.from_dynamic! get_json("/api/v2/simple/datascan/#{query}", params: params)
42
+ params = {page:, apikey: api_key}
43
+ Structs::Onyphe::Response.from_dynamic! get_json("/api/v2/simple/datascan/#{query}", params:)
44
44
  end
45
45
 
46
46
  #
@@ -52,7 +52,7 @@ module Mihari
52
52
  def datascan_with_pagination(query, pagination_limit: Mihari.config.pagination_limit)
53
53
  Enumerator.new do |y|
54
54
  (1..pagination_limit).each do |page|
55
- res = datascan(query, page: page)
55
+ res = datascan(query, page:)
56
56
 
57
57
  y.yield res
58
58
 
@@ -16,7 +16,7 @@ module Mihari
16
16
  raise(ArgumentError, "api_key is required") unless api_key
17
17
 
18
18
  headers["x-otx-api-key"] = api_key
19
- super(base_url, headers: headers, timeout: timeout)
19
+ super(base_url, headers:, timeout:)
20
20
  end
21
21
 
22
22
  #
@@ -21,7 +21,7 @@ module Mihari
21
21
 
22
22
  headers["authorization"] = "Basic #{Base64.strict_encode64("#{username}:#{api_key}")}"
23
23
 
24
- super(base_url, headers: headers, timeout: timeout)
24
+ super(base_url, headers:, timeout:)
25
25
  end
26
26
 
27
27
  #
@@ -32,8 +32,8 @@ module Mihari
32
32
  # @return [Hash]
33
33
  #
34
34
  def passive_dns_search(query)
35
- params = { query: query }
36
- get_json("/v2/dns/passive/unique", params: params)
35
+ params = {query:}
36
+ get_json("/v2/dns/passive/unique", params:)
37
37
  end
38
38
 
39
39
  #
@@ -45,7 +45,7 @@ module Mihari
45
45
  #
46
46
  def reverse_whois_search(query)
47
47
  get_json("/v2/whois/search", params: {
48
- query: query,
48
+ query:,
49
49
  field: "email"
50
50
  }.compact)
51
51
  end
@@ -58,7 +58,7 @@ module Mihari
58
58
  # @return [Hash]
59
59
  #
60
60
  def ssl_search(query)
61
- get_json("/v2/ssl-certificate/history", params: { query: query })
61
+ get_json("/v2/ssl-certificate/history", params: {query:})
62
62
  end
63
63
  end
64
64
  end
@@ -20,7 +20,7 @@ module Mihari
20
20
 
21
21
  @api_key = api_key
22
22
 
23
- super(base_url, headers: headers, timeout: timeout)
23
+ super(base_url, headers:, timeout:)
24
24
  end
25
25
 
26
26
  #
@@ -29,7 +29,7 @@ module Mihari
29
29
  # @return [Hash]
30
30
  #
31
31
  def get_indicator(ip_or_domain)
32
- get_json "/api/info.php", params: { indicator: ip_or_domain, key: api_key }
32
+ get_json "/api/info.php", params: {indicator: ip_or_domain, key: api_key}
33
33
  end
34
34
 
35
35
  #
@@ -38,7 +38,7 @@ module Mihari
38
38
  # @return [Hash]
39
39
  #
40
40
  def get_properties(indicator_id)
41
- get_json "/api/info.php", params: { iid: indicator_id, get: "properties", key: api_key }
41
+ get_json "/api/info.php", params: {iid: indicator_id, get: "properties", key: api_key}
42
42
  end
43
43
  end
44
44
  end
@@ -17,7 +17,7 @@ module Mihari
17
17
 
18
18
  headers["apikey"] = api_key
19
19
 
20
- super(base_url, headers: headers, timeout: timeout)
20
+ super(base_url, headers:, timeout:)
21
21
  end
22
22
 
23
23
  #
@@ -48,7 +48,7 @@ module Mihari
48
48
  # @return [Hash]
49
49
  #
50
50
  def search_by_mail(mail)
51
- post_json "/v1/domains/list", json: { filter: { whois_email: mail } }
51
+ post_json "/v1/domains/list", json: {filter: {whois_email: mail}}
52
52
  end
53
53
 
54
54
  #
@@ -57,7 +57,7 @@ module Mihari
57
57
  # @return [Hash]
58
58
  #
59
59
  def search_by_ip(ip)
60
- post_json "/v1/domains/list", json: { filter: { ipv4: ip } }
60
+ post_json "/v1/domains/list", json: {filter: {ipv4: ip}}
61
61
  end
62
62
 
63
63
  #
@@ -69,13 +69,13 @@ module Mihari
69
69
  #
70
70
  def get_all_dns_history(domain, type:, page: 1)
71
71
  Enumerator.new do |y|
72
- res = get_dns_history(domain, type: type, page: page)
72
+ res = get_dns_history(domain, type:, page:)
73
73
  y.yield res
74
74
 
75
75
  pages = res["pages"].to_i
76
76
 
77
77
  (page + 1..pages).each do |page|
78
- y.yield get_dns_history(domain, type: type, page: page)
78
+ y.yield get_dns_history(domain, type:, page:)
79
79
  end
80
80
  end
81
81
  end
@@ -90,7 +90,7 @@ module Mihari
90
90
  # @return [Hash]
91
91
  #
92
92
  def get_dns_history(domain, type:, page:)
93
- get_json "/v1/history/#{domain}/dns/#{type}", params: { page: page }
93
+ get_json "/v1/history/#{domain}/dns/#{type}", params: {page:}
94
94
  end
95
95
  end
96
96
  end
@@ -27,7 +27,7 @@ module Mihari
27
27
  )
28
28
  raise(ArgumentError, "api_key is required") unless api_key
29
29
 
30
- super(base_url, headers: headers, pagination_interval: pagination_interval, timeout: timeout)
30
+ super(base_url, headers:, pagination_interval:, timeout:)
31
31
 
32
32
  @api_key = api_key
33
33
  end
@@ -41,12 +41,12 @@ module Mihari
41
41
  #
42
42
  def search(query, page: 1, minify: true)
43
43
  params = {
44
- query: query,
45
- page: page,
46
- minify: minify,
44
+ query:,
45
+ page:,
46
+ minify:,
47
47
  key: api_key
48
48
  }
49
- Structs::Shodan::Response.from_dynamic! get_json("/shodan/host/search", params: params)
49
+ Structs::Shodan::Response.from_dynamic! get_json("/shodan/host/search", params:)
50
50
  end
51
51
 
52
52
  #
@@ -59,7 +59,7 @@ module Mihari
59
59
  def search_with_pagination(query, minify: true, pagination_limit: Mihari.config.pagination_limit)
60
60
  Enumerator.new do |y|
61
61
  (1..pagination_limit).each do |page|
62
- res = search(query, page: page, minify: minify)
62
+ res = search(query, page:, minify:)
63
63
 
64
64
  y.yield res
65
65
 
@@ -12,7 +12,7 @@ module Mihari
12
12
  # @param [Integer, nil] timeout
13
13
  #
14
14
  def initialize(base_url = "https://internetdb.shodan.io", headers: {}, timeout: nil)
15
- super(base_url, headers: headers, timeout: timeout)
15
+ super(base_url, headers:, timeout:)
16
16
  end
17
17
 
18
18
  #
@@ -19,7 +19,7 @@ module Mihari
19
19
  raise(ArgumentError, "api_key is required") unless api_key
20
20
 
21
21
  headers["authorization"] = "Bearer #{api_key}"
22
- super(base_url, headers: headers, timeout: timeout)
22
+ super(base_url, headers:, timeout:)
23
23
 
24
24
  @api_version = api_version
25
25
  end
@@ -31,7 +31,7 @@ module Mihari
31
31
  #
32
32
  def alert(json)
33
33
  json = json.to_camelback_keys.compact
34
- post_json("/api/#{api_version}/alert", json: json)
34
+ post_json("/api/#{api_version}/alert", json:)
35
35
  end
36
36
  end
37
37
  end
@@ -24,7 +24,7 @@ module Mihari
24
24
 
25
25
  headers["api-key"] = api_key
26
26
 
27
- super(base_url, headers: headers, pagination_interval: pagination_interval, timeout: timeout)
27
+ super(base_url, headers:, pagination_interval:, timeout:)
28
28
  end
29
29
 
30
30
  #
@@ -35,8 +35,8 @@ module Mihari
35
35
  # @return [Mihari::Structs::Urlscan::Response]
36
36
  #
37
37
  def search(q, size: nil, search_after: nil)
38
- params = { q: q, size: size, search_after: search_after }.compact
39
- Structs::Urlscan::Response.from_dynamic! get_json("/api/v1/search/", params: params)
38
+ params = {q:, size:, search_after:}.compact
39
+ Structs::Urlscan::Response.from_dynamic! get_json("/api/v1/search/", params:)
40
40
  end
41
41
 
42
42
  #
@@ -51,7 +51,7 @@ module Mihari
51
51
 
52
52
  Enumerator.new do |y|
53
53
  pagination_limit.times do
54
- res = search(q, size: size, search_after: search_after)
54
+ res = search(q, size:, search_after:)
55
55
 
56
56
  y.yield res
57
57
 
@@ -24,7 +24,7 @@ module Mihari
24
24
 
25
25
  headers["x-apikey"] = api_key
26
26
 
27
- super(base_url, headers: headers, pagination_interval: pagination_interval, timeout: timeout)
27
+ super(base_url, headers:, pagination_interval:, timeout:)
28
28
  end
29
29
 
30
30
  #
@@ -52,8 +52,8 @@ module Mihari
52
52
  # @return [Mihari::Structs::VirusTotalIntelligence::Response]
53
53
  #
54
54
  def intel_search(query, cursor: nil)
55
- params = { query: query, cursor: cursor }.compact
56
- Structs::VirusTotalIntelligence::Response.from_dynamic! get_json("/api/v3/intelligence/search", params: params)
55
+ params = {query:, cursor:}.compact
56
+ Structs::VirusTotalIntelligence::Response.from_dynamic! get_json("/api/v3/intelligence/search", params:)
57
57
  end
58
58
 
59
59
  #
@@ -67,7 +67,7 @@ module Mihari
67
67
 
68
68
  Enumerator.new do |y|
69
69
  pagination_limit.times do
70
- res = intel_search(query, cursor: cursor)
70
+ res = intel_search(query, cursor:)
71
71
 
72
72
  y.yield res
73
73