class Mihari::Analyzers::ZoomEye

Constants

PAGE_SIZE

Public Instance Methods

artifacts() click to toggle source
# File lib/mihari/analyzers/zoomeye.rb, line 14
def artifacts
  case type
  when "host"
    host_search
  when "web"
    web_search
  else
    raise InvalidInputError, "#{type} type is not supported." unless valid_type?
  end
end

Private Instance Methods

api() click to toggle source
# File lib/mihari/analyzers/zoomeye.rb, line 42
def api
  @api ||= ::ZoomEye::API.new(api_key: Mihari.config.zoomeye_api_key)
end
configuration_keys() click to toggle source
# File lib/mihari/analyzers/zoomeye.rb, line 38
def configuration_keys
  %w[zoomeye_api_key]
end
convert_responses(responses) click to toggle source

Convert responses into an array of String

@param [Array<Hash>] responses

@return [Array<String>]

# File lib/mihari/analyzers/zoomeye.rb, line 53
def convert_responses(responses)
  responses.map do |res|
    matches = res["matches"] || []
    matches.map do |match|
      match["ip"]
    end
  end.flatten.compact.uniq
end
valid_type?() click to toggle source

Check whether a type is valid or not

@return [Boolean]

# File lib/mihari/analyzers/zoomeye.rb, line 34
def valid_type?
  %w[host web].include? type
end