Class: Mihari::Analyzers::OTX

Inherits:
Base
  • Object
show all
Includes:
Mixins::Refang
Defined in:
lib/mihari/analyzers/otx.rb

Constant Summary

Constants included from Mixins::Retriable

Mixins::Retriable::DEFAULT_ON

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Mixins::Refang

#refang

Methods inherited from Base

#class_name, inherited, #normalized_artifacts, #source

Methods included from Mixins::Retriable

#retry_on_error

Methods included from Mixins::Configurable

#configuration_keys?, #configuration_values, #configured?

Constructor Details

#initialize(*args, **kwargs) ⇒ OTX

Returns a new instance of OTX.



19
20
21
22
23
24
25
26
# File 'lib/mihari/analyzers/otx.rb', line 19

def initialize(*args, **kwargs)
  super

  @query = refang(query)
  @type = TypeChecker.type(query)

  @api_key = kwargs[:api_key] || Mihari.config.otx_api_key
end

Instance Attribute Details

#api_keyString? (readonly)

Returns:

  • (String, nil)


14
15
16
# File 'lib/mihari/analyzers/otx.rb', line 14

def api_key
  @api_key
end

#queryString (readonly)

Returns:

  • (String)


17
18
19
# File 'lib/mihari/analyzers/otx.rb', line 17

def query
  @query
end

#typeString? (readonly)

Returns:

  • (String, nil)


11
12
13
# File 'lib/mihari/analyzers/otx.rb', line 11

def type
  @type
end

Instance Method Details

#artifactsObject



28
29
30
31
32
33
34
35
36
37
# File 'lib/mihari/analyzers/otx.rb', line 28

def artifacts
  case type
  when "domain"
    domain_search
  when "ip"
    ip_search
  else
    raise InvalidInputError, "#{query}(type: #{type || "unknown"}) is not supported." unless valid_type?
  end
end