Class: Mihari::Services::CPEBuilder

Inherits:
Mihari::Service show all
Defined in:
lib/mihari/services/builders.rb

Overview

CPE builder

Instance Method Summary collapse

Methods inherited from Mihari::Service

call, #result, result

Instance Method Details

#call(ip, enricher: Enrichers::Shodan.new) ⇒ Array<Mihari::Models::CPE>

Build CPEs

Parameters:

Returns:



53
54
55
56
57
# File 'lib/mihari/services/builders.rb', line 53

def call(ip, enricher: Enrichers::Shodan.new)
  enricher.result(ip).fmap do |res|
    (res&.cpes || []).map { |cpe| Models::CPE.new(cpe: cpe) }
  end.value_or []
end