Sha256: 1a46e5c037cfa127bec8a2fd5848912abd39aaabcd7fdaf8eadda1af68416db4
Contents?: true
Size: 647 Bytes
Versions: 3
Compression:
Stored size: 647 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 # @param [Mihari::Enrichers::Shodan] enricher # # @return [Array<Mihari::Port>] # 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 end result.value_or [] end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mihari-5.6.1 | lib/mihari/models/port.rb |
mihari-5.6.0 | lib/mihari/models/port.rb |
mihari-5.5.0 | lib/mihari/models/port.rb |