lib/mihari/models/port.rb in mihari-5.4.9 vs lib/mihari/models/port.rb in mihari-5.5.0
- old
+ new
@@ -9,14 +9,15 @@
#
# Build ports
#
# @param [String] ip
+ # @param [Mihari::Enrichers::Shodan] enricher
#
# @return [Array<Mihari::Port>]
#
- def build_by_ip(ip)
- result = Enrichers::Shodan.query_result(ip).bind do |res|
+ def build_by_ip(ip, enricher: Enrichers::Shodan.new)
+ result = enricher.query_result(ip).bind do |res|
if res.nil?
Success []
else
Success(res.ports.map { |port| new(port: port) })
end