Sha256: ec1630b93f99d07d5cd7b8547882d56f54720b232c14dab73107c4c34a078b70
Contents?: true
Size: 671 Bytes
Versions: 3
Compression:
Stored size: 671 Bytes
Contents
# frozen_string_literal: true module Mihari class AutonomousSystem < ActiveRecord::Base belongs_to :artifact class << self include Dry::Monads[:result] # # Build AS # # @param [String] ip # @param [Mihari::Enrichers::IPInfo] enricher # # @return [Mihari::AutonomousSystem, nil] # def build_by_ip(ip, enricher: Enrichers::IPInfo.new) result = enricher.query_result(ip).bind do |res| value = res&.asn if value.nil? Success nil else Success new(asn: value) end end result.value_or nil end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mihari-5.6.1 | lib/mihari/models/autonomous_system.rb |
mihari-5.6.0 | lib/mihari/models/autonomous_system.rb |
mihari-5.5.0 | lib/mihari/models/autonomous_system.rb |