Class: Mihari::Analyzers::HunterHow

Inherits:
Base show all
Defined in:
lib/mihari/analyzers/hunterhow.rb

Overview

hunter.how analyzer

Constant Summary

Constants included from Concerns::Retriable

Concerns::Retriable::DEFAULT_CONDITION, Concerns::Retriable::RETRIABLE_ERRORS

Instance Attribute Summary collapse

Attributes inherited from Base

#query

Attributes inherited from Mihari::Actor

#options

Instance Method Summary collapse

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

#retry_on_error

Methods included from Concerns::Configurable

#configuration_keys?, #configured?

Constructor Details

#initialize(query, start_time: nil, end_time: nil, options: nil, api_key: nil) ⇒ HunterHow

Returns a new instance of HunterHow.

Parameters:

  • query (String)
  • start_time (Date) (defaults to: nil)
  • end_time (Date) (defaults to: nil)
  • options (Hash, nil) (defaults to: nil)
  • api_key (String, nil) (defaults to: nil)


25
26
27
28
29
30
31
32
# File 'lib/mihari/analyzers/hunterhow.rb', line 25

def initialize(query, start_time: nil, end_time: nil, options: nil, api_key: nil)
  super(query, options:)

  @api_key = api_key || Mihari.config.hunterhow_api_key

  @start_time = start_time
  @end_time = end_time
end

Instance Attribute Details

#api_keyString? (readonly)

Returns:

  • (String, nil)


10
11
12
# File 'lib/mihari/analyzers/hunterhow.rb', line 10

def api_key
  @api_key
end

#end_timeDate (readonly)

Returns:

  • (Date)


16
17
18
# File 'lib/mihari/analyzers/hunterhow.rb', line 16

def end_time
  @end_time
end

#start_timeDate (readonly)

Returns:

  • (Date)


13
14
15
# File 'lib/mihari/analyzers/hunterhow.rb', line 13

def start_time
  @start_time
end

Instance Method Details

#artifactsArray<Mihari::Models::Artifact>

Returns:



37
38
39
40
41
42
43
44
45
# File 'lib/mihari/analyzers/hunterhow.rb', line 37

def artifacts
  client.search_with_pagination(
    query,
    start_time: start_time.strftime("%Y-%m-%d"),
    end_time: end_time.strftime("%Y-%m-%d")
  ).map do |res|
    res.data.artifacts
  end.flatten
end