Sha256: 4597d3837fa47a3dc700db4e6ba8863ff2d16cf6395ecf506f71f8bea4df7600
Contents?: true
Size: 1 KB
Versions: 8
Compression:
Stored size: 1 KB
Contents
# frozen_string_literal: true module Mihari module Enrichers # # MMDB enricher # class MMDB < Base # # @param [Mihari::Models::Artifact] artifact # def call(artifact) res = client.query(artifact.data) artifact.tap do |tapped| tapped.autonomous_system ||= Models::AutonomousSystem.new(number: res.asn) if res.asn if res.country_code tapped.geolocation ||= Models::Geolocation.new( country: NormalizeCountry(res.country_code, to: :short), country_code: res.country_code ) end end end private # # @param [Mihari::Models::Artifact] artifact # # @return [Boolean] # def callable_relationships?(artifact) artifact.geolocation.nil? || artifact.autonomous_system.nil? end def supported_data_types %w[ip] end def client @client ||= Clients::MMDB.new(timeout:) end end end end
Version data entries
8 entries across 8 versions & 1 rubygems