File::VirusScan - Unified interface for virus scanning of files/directories
my $scanner = File::VirusScan->new({ engines => { '-Daemon::ClamAV::Clamd' => { socket_name => '/var/run/clamav/clamd.ctl', }, '-Command::FSecure::FSAV' => { path => '/usr/local/bin/fsav }, '-Daemon::FPROT::V6' => { host => '127.0.0.1', port => 10200, } }, order => [ '-Daemon::ClamAV::Clamd', '-Daemon::FPROT::V6', '-Command::FSecure::FSAV' ], always_scan => 0, }); my $result = $scanner->scan( "/tmp/uploaded-files" ); if( $result->all_clean ) { return 'Happiness and puppies!'; } else { return 'Oh noes! You've got ' . join(',' @{ $result->virus_names } ); }
This class provides a common API for scanning files or directories with one or more third party virus scanners.
Virus scanners are supported via pluggable engines under the File::VirusScan::Engine namespace. At the time of this release, the following plugins are shipped with File::VirusScan:
Scanning daemon via File::VirusScan::Engine::Daemon::ClamAV::Clamd, and commandline scanner via File::VirusScan::Engine::Command::ClamAV::Clamscan
File::VirusScan::Engine::Command::NAI::Uvscan
File::VirusScan::Engine::Command::FSecure::FSAV
Scanning daemon via File::VirusScan::Engine::Daemon::Trend::Trophie, commandline scanning via File::VirusScan::Engine::Command::Trend::Vscan
File::VirusScan::Engine::Command::BitDefender::BDC
File::VirusScan::Engine::Command::Authentium::CommandAntivirus
File::VirusScan::Engine::Command::Norman::NVCC
Scanning via esets_cli with File::VirusScan::Engine::Command::ESET::NOD32
Scanning via Carrier Scan server with File::VirusScan::Engine::Daemon::Symantec::CSS
Scanning daemon via File::VirusScan::Engine::Daemon::FPROT::V4 and File::VirusScan::Engine::Daemon::FPROT::V6, as well as the commandline scanners via File::VirusScan::Engine::Command::FPROT::FPROT and File::VirusScan::Engine::Command::FPROT::Fpscan
File::VirusScan::Engine::Command::CentralCommand::Vexira
Daemonized scanning using the Sophie daemon with File::VirusScan::Engine::Daemon::Sophos::Sophie. Commandline scanning with File::VirusScan::Engine::Command::Sophos::Sweep or File::VirusScan::Engine::Command::Sophos::Savscan
Scanning with aveserver using File::VirusScan::Engine::Command::Kaspersky::AVP5, or with kavscanner using File::VirusScan::Engine::Command::Kaspersky::Kavscanner
Creates a new File::VirusScan object, using configuration data in the provided hashref.
Required configuration options are:
Reference to hash of backend virus scan engines to be used, and their specific configurations.
Keys must refer to a class that implements the File::VirusScan::Engine interface, and may be specified as either:
A fully-qualified class name.
A name beginning with '-', in which case the '-' is removed and replaced with the File::VirusScan::Engine:: prefix.
Values should be another hash reference containing engine-specific configuration. This will vary by backend, but generally requires at minimum some way of locating (socket path, host/port) or executing (path to executable) the scanner.
Optional configuration options are:
List reference containing keys provided to engines above, in the order in which they should be called.
If omitted, backends will be invoked in hash key order.
By default, File::VirusScan will stop scanning a message after one backend finds a virus. If you wish to run all backends anyway, set this option to a true value.
Invokes the configured scan backends on the path. The path may be either a single file, or a directory.
Returns an File::VirusScan::ResultSet object, which can be queried for status.
Returns a reference to the internal array of configured backend instances.
File::VirusScan::Engine, File::VirusScan::Result
Dave O'Neill (dmo@roaringpenguin.com)
Dianne Skoll (dianne@skoll.ca>
Copyright (c) 2007 Roaring Penguin Software, Inc.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, or (at your option) any later version.
To install File::VirusScan, copy and paste the appropriate command in to your terminal.
cpanm
cpanm File::VirusScan
CPAN shell
perl -MCPAN -e shell install File::VirusScan
For more information on module installation, please visit the detailed CPAN module installation guide.