Sha256: 658f0b42ad1239de910091db5d680bd24f3a48d96f04464f12106a2bcf214267

Contents?: true

Size: 1.08 KB

Versions: 8

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

module Mihari
  module Services
    class ArtifactGetter < Service
      #
      # @param [Integer] id
      #
      # @return [Mihari::Models::Artifact]
      #
      def call(id)
        Mihari::Models::Artifact.eager_load(
          :autonomous_system,
          :geolocation,
          :whois_record,
          :dns_records,
          :reverse_dns_names
        ).find id
      end
    end

    class AlertGetter < Service
      #
      # @param [Integer] id
      #
      # @return [Mihari::Models::Artifact]
      #
      def call(id)
        Mihari::Models::Alert.eager_load(
          :artifacts,
          rule: :tags
        ).find id
      end
    end

    class RuleGetter < Service
      #
      # @param [String] id
      #
      # @return [Mihari::Models::Rule]
      #
      def call(id)
        Mihari::Models::Rule.find id
      end
    end

    class IPGetter < Service
      #
      # @param [String] ip
      #
      # @return [Mihari::Structs::MMDB::Response]
      #
      def call(ip)
        Clients::MMDB.new.query ip
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mihari-8.0.0 lib/mihari/services/getters.rb
mihari-7.6.4 lib/mihari/services/getters.rb
mihari-7.6.3 lib/mihari/services/getters.rb
mihari-7.6.2 lib/mihari/services/getters.rb
mihari-7.6.1 lib/mihari/services/getters.rb
mihari-7.6.0 lib/mihari/services/getters.rb
mihari-7.5.0 lib/mihari/services/getters.rb
mihari-7.4.0 lib/mihari/services/getters.rb