Class: Mihari::Analyzers::PassiveTotal

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

Constant Summary

Constants included from Mixins::Retriable

Mixins::Retriable::DEFAULT_ON

Instance Attribute Summary collapse

Attributes inherited from Base

#rule

Instance Method Summary collapse

Methods included from Mixins::Refang

#refang

Methods inherited from Base

inherited, #normalized_artifacts, #run, #run_emitter, #source

Methods included from Mixins::Retriable

#retry_on_error

Methods included from Mixins::Configurable

#configuration_values

Methods included from Mixins::AutonomousSystem

#normalize_asn

Constructor Details

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



21
22
23
24
25
26
27
28
29
# File 'lib/mihari/analyzers/passivetotal.rb', line 21

def initialize(*args, **kwargs)
  super(*args, **kwargs)

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

  @username = kwargs[:username] || Mihari.config.passivetotal_username
  @api_key = kwargs[:api_key] || Mihari.config.passivetotal_api_key
end

Instance Attribute Details

#api_keyString? (readonly)



19
20
21
# File 'lib/mihari/analyzers/passivetotal.rb', line 19

def api_key
  @api_key
end

#typeString? (readonly)



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

def type
  @type
end

#usernameString? (readonly)



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

def username
  @username
end

Instance Method Details

#artifactsObject



31
32
33
# File 'lib/mihari/analyzers/passivetotal.rb', line 31

def artifacts
  search || []
end

#configured?Boolean



35
36
37
# File 'lib/mihari/analyzers/passivetotal.rb', line 35

def configured?
  configuration_keys.all? { |key| Mihari.config.send(key) } || (username? && api_key?)
end