Sha256: eb6f2a1e9fe9be5c35e666c0393b6f47ac58a28ca59e270ba70d215cad3bc0a0

Contents?: true

Size: 1.09 KB

Versions: 11

Compression:

Stored size: 1.09 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
      #
      # @params [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)
        Mihari::Enrichers::MMDB.new.call ip
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
mihari-7.2.0 lib/mihari/services/getters.rb
mihari-7.1.3 lib/mihari/services/getters.rb
mihari-7.1.2 lib/mihari/services/getters.rb
mihari-7.1.1 lib/mihari/services/getters.rb
mihari-7.1.0 lib/mihari/services/getters.rb
mihari-7.0.5 lib/mihari/services/getters.rb
mihari-7.0.4 lib/mihari/services/getters.rb
mihari-7.0.3 lib/mihari/services/getters.rb
mihari-7.0.2 lib/mihari/services/getters.rb
mihari-7.0.1 lib/mihari/services/getters.rb
mihari-7.0.0 lib/mihari/services/getters.rb