Sha256: e9a42843ea48db5fd06a0639221a65b8dd7894c41ede78d3c408981b6a8c5e0c
Contents?: true
Size: 571 Bytes
Versions: 6
Compression:
Stored size: 571 Bytes
Contents
# frozen_string_literal: true module Mihari class Port < ActiveRecord::Base belongs_to :artifact class << self include Dry::Monads[:result] # # Build ports # # @param [String] ip # # @return [Array<Mihari::Port>] # def build_by_ip(ip) result = Enrichers::Shodan.query_result(ip).bind do |res| if res.nil? Success [] else Success(res.ports.map { |port| new(port: port) }) end end result.value_or [] end end end end
Version data entries
6 entries across 6 versions & 1 rubygems