Sha256: 9b1cd8fc382858f3a805791f2bd3f3056ee9ff8de50b7077d21cd91f3991c7e3
Contents?: true
Size: 1.3 KB
Versions: 2
Compression:
Stored size: 1.3 KB
Contents
# Copyright (c) 2021 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details. # frozen_string_literal: true require 'contrast/components/interface' # This module is used to find funchook library and determine availability module Funchook include Contrast::Components::Interface access_component :logging attr_accessor :path # Possible platform library files ACCEPTABLE_FILES = %w[libfunchook.dylib libfunchook.so].cs__freeze # Top level agent directories that should have the funchook libraries SEARCH_DIRS = [ File.join('ext'), File.join('shared_libraries'), File.join('funchook', 'src') ].cs__freeze AGENT_ROOT = File.join(__dir__, '..', '..', '..') def self.resolve_path! actual_path_segments = SEARCH_DIRS.product(ACCEPTABLE_FILES).find do |potential_funchook_path| load_path = absolute_path(potential_funchook_path) File.exist?(load_path) end if actual_path_segments.nil? logger.warn('Unable to find funchook') else @path = absolute_path(actual_path_segments) logger.info('Funchook found', path: @path) end @path end def self.absolute_path path_array File.absolute_path(File.join(AGENT_ROOT, *path_array)) end def self.available? @_available ||= !!resolve_path! end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
contrast-agent-4.6.0 | lib/contrast/funchook/funchook.rb |
contrast-agent-4.5.0 | lib/contrast/funchook/funchook.rb |