Class: Mihari::Services::PortBuilder

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

Overview

Port 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::Port>

Build ports

Parameters:

Returns:



115
116
117
118
119
# File 'lib/mihari/services/builders.rb', line 115

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