Sha256: 916f9155263942615a63aa1343294f3fd6876c1a3cf0bdb728602f697ec9325e

Contents?: true

Size: 704 Bytes

Versions: 7

Compression:

Stored size: 704 Bytes

Contents

require "ostruct"
require "shellwords"

module Ddr::Actions
  class VirusCheck

    # @return [Hash] result data
    # @raises [Ddr::Antivirus::VirusFoundError]
    def self.call(file_path)
      unless File.exist?(file_path)
        raise Error, "File not found: #{file_path}"
      end
      result = {}
      begin
        scan_result = Ddr::Antivirus.scan(file_path)
      rescue Ddr::Antivirus::ScannerError => e
        result[:exception] = [e.class.name, e.to_s]
        scan_result = e.result
      end
      result[:event_date_time] = scan_result.scanned_at
      result[:software]        = scan_result.version
      result[:detail]          = scan_result.output
      result
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ddr-models-2.6.2 lib/ddr/actions/virus_check.rb
ddr-models-2.6.1 lib/ddr/actions/virus_check.rb
ddr-models-2.6.0 lib/ddr/actions/virus_check.rb
ddr-models-2.6.0.rc4 lib/ddr/actions/virus_check.rb
ddr-models-2.6.0.rc3 lib/ddr/actions/virus_check.rb
ddr-models-2.6.0.rc2 lib/ddr/actions/virus_check.rb
ddr-models-2.6.0.rc1 lib/ddr/actions/virus_check.rb