Sha256: 8c18949220c2eeececdd2d3c751649fd976f075c0a335afc0eeaca97ef79a6ca
Contents?: true
Size: 1.01 KB
Versions: 3
Compression:
Stored size: 1.01 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: timeout) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mihari-7.3.2 | lib/mihari/enrichers/mmdb.rb |
mihari-7.3.1 | lib/mihari/enrichers/mmdb.rb |
mihari-7.3.0 | lib/mihari/enrichers/mmdb.rb |