Class: Mihari::Analyzers::ZoomEye
- Inherits:
-
Base
- Object
- Mihari::Actor
- Base
- Mihari::Analyzers::ZoomEye
- Defined in:
- lib/mihari/analyzers/zoomeye.rb
Overview
ZoomEye analyzer
Constant Summary
Constants included from Concerns::Retriable
Concerns::Retriable::DEFAULT_CONDITION, Concerns::Retriable::RETRIABLE_ERRORS
Instance Attribute Summary collapse
- #api_key ⇒ String? readonly
- #type ⇒ String readonly
Attributes inherited from Base
Attributes inherited from Mihari::Actor
Instance Method Summary collapse
- #artifacts ⇒ Object
-
#initialize(query, options: nil, api_key: nil, type: "host") ⇒ ZoomEye
constructor
A new instance of ZoomEye.
Methods inherited from Base
#call, from_params, #ignore_error?, inherited, #normalized_artifacts, #pagination_interval, #pagination_limit, #parallel?, #result, #truncated_query
Methods inherited from Mihari::Actor
#call, configuration_keys, key, key_aliases, keys, #result, #retry_exponential_backoff, #retry_interval, #retry_times, #timeout, type, #validate_configuration!
Methods included from Concerns::Retriable
Methods included from Concerns::Configurable
#configuration_keys?, #configured?
Constructor Details
#initialize(query, options: nil, api_key: nil, type: "host") ⇒ ZoomEye
Returns a new instance of ZoomEye.
21 22 23 24 25 26 |
# File 'lib/mihari/analyzers/zoomeye.rb', line 21 def initialize(query, options: nil, api_key: nil, type: "host") super(query, options:) @type = type @api_key = api_key || Mihari.config.zoomeye_api_key end |
Instance Attribute Details
#api_key ⇒ String? (readonly)
10 11 12 |
# File 'lib/mihari/analyzers/zoomeye.rb', line 10 def api_key @api_key end |
#type ⇒ String (readonly)
13 14 15 |
# File 'lib/mihari/analyzers/zoomeye.rb', line 13 def type @type end |
Instance Method Details
#artifacts ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/mihari/analyzers/zoomeye.rb', line 28 def artifacts case type when "host" client.host_search_with_pagination(query).map do |res| convert(res) end.flatten when "web" client.web_search_with_pagination(query).map do |res| convert(res) end.flatten else raise ValueError, "#{type} type is not supported." unless valid_type? end end |