Class: Mihari::Analyzers::BinaryEdge

Inherits:
Base
  • Object
show all
Defined in:
lib/mihari/analyzers/binaryedge.rb

Constant Summary

Constants included from Mixins::Retriable

Mixins::Retriable::DEFAULT_ON

Instance Attribute Summary collapse

Attributes inherited from Base

#ignore_old_artifacts, #ignore_threshold

Instance Method Summary collapse

Methods inherited from Base

#description, inherited, #normalized_artifacts, #run, #run_emitter, #source, #tags, #title

Methods included from Mixins::Retriable

#retry_on_error

Methods included from Mixins::Database

#with_db_connection

Methods included from Mixins::Configurable

#configuration_values, #configured?

Methods included from Mixins::AutonomousSystem

#normalize_asn

Constructor Details

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

Returns a new instance of BinaryEdge.



15
16
17
18
19
# File 'lib/mihari/analyzers/binaryedge.rb', line 15

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

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

Instance Attribute Details

#api_keyString? (readonly)

Returns:

  • (String, nil)


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

def api_key
  @api_key
end

Instance Method Details

#artifactsObject



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

def artifacts
  results = search
  return [] unless results || results.empty?

  results.map do |result|
    events = result["events"] || []
    events.filter_map do |event|
      data = event.dig("target", "ip")
      data.nil? ? nil : Artifact.new(data: data, source: source, metadata: event)
    end
  end.flatten
end