Class: Mihari::Analyzers::Onyphe

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

Instance Attribute Summary collapse

Attributes inherited from Base

#the_hive

Instance Method Summary collapse

Methods inherited from Base

#run, #run_emitter

Constructor Details

#initialize(query, title: nil, description: nil, tags: []) ⇒ Onyphe

Returns a new instance of Onyphe.



14
15
16
17
18
19
20
21
22
# File 'lib/mihari/analyzers/onyphe.rb', line 14

def initialize(query, title: nil, description: nil, tags: [])
  super()

  @api = ::Onyphe::API.new
  @query = query
  @title = title || "Onyphe lookup"
  @description = description || "query = #{query}"
  @tags = tags
end

Instance Attribute Details

#apiObject (readonly)

Returns the value of attribute api.



8
9
10
# File 'lib/mihari/analyzers/onyphe.rb', line 8

def api
  @api
end

#descriptionObject (readonly)

Returns the value of attribute description.



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

def description
  @description
end

#queryObject (readonly)

Returns the value of attribute query.



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

def query
  @query
end

#tagsObject (readonly)

Returns the value of attribute tags.



12
13
14
# File 'lib/mihari/analyzers/onyphe.rb', line 12

def tags
  @tags
end

#titleObject (readonly)

Returns the value of attribute title.



9
10
11
# File 'lib/mihari/analyzers/onyphe.rb', line 9

def title
  @title
end

Instance Method Details

#artifactsObject



24
25
26
27
28
29
30
# File 'lib/mihari/analyzers/onyphe.rb', line 24

def artifacts
  result = search
  return [] unless result

  results = result.dig("results") || []
  results.map { |e| e.dig("ip") }.compact
end