Sha256: 5d0f165259462a22045a26f8825b48b327aea561d2112a519d7fd7564211e24b
Contents?: true
Size: 684 Bytes
Versions: 2
Compression:
Stored size: 684 Bytes
Contents
require 'clam_chowder/backend' require 'clam_chowder/response' require 'clamd' module ClamChowder module Backend class Clamd def initialize @clamd = ::Clamd::Client.new end def scan_file(path) parse_response(@clamd.scan(path)) end private def parse_response(str) /^(?<file_path>.*): (?<virus_name>.*)\s?(?<status>(OK|FOUND))$/ =~ str case status when 'OK' ClamChowder::Response.new(status, file_path) when "FOUND" ClamChowder::Response.new(status, file_path, virus_name.strip) else raise ScanException.new(str) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
clam_chowder-0.0.2 | lib/clam_chowder/backend/clamd.rb |
clam_chowder-0.0.1 | lib/clam_chowder/backend/clamd.rb |