NAME
File::VirusScan - Unified interface for virus scanning of files/directories
SYNOPSIS
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 } );
}
DESCRIPTION
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:
- Clam Antivirus
-
Scanning daemon via File::VirusScan::Engine::Daemon::ClamAV::Clamd, and commandline scanner via File::VirusScan::Engine::Command::ClamAV::Clamscan
- NAI UVScan
- F-Secure FSAV
- Trend Micro
-
Scanning daemon via File::VirusScan::Engine::Daemon::Trend::Trophie, commandline scanning via File::VirusScan::Engine::Command::Trend::Vscan
- BitDefender BDC
- Command Antivirus
-
File::VirusScan::Engine::Command::Authentium::CommandAntivirus
- Norman Antivirus
- ESET
-
Scanning via esets_cli with File::VirusScan::Engine::Command::ESET::NOD32
- Symantec
-
Scanning via Carrier Scan server with File::VirusScan::Engine::Daemon::Symantec::CSS
- F-PROT
-
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
- Central Command Vexira
- Sophos
-
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
- Kaspersky
-
Scanning with aveserver using File::VirusScan::Engine::Command::Kaspersky::AVP5, or with kavscanner using File::VirusScan::Engine::Command::Kaspersky::Kavscanner
METHODS
new ( { config data } )
Creates a new File::VirusScan object, using configuration data in the provided hashref.
Required configuration options are:
- engines
-
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:
- order
-
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.
- always_scan
-
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.
scan ( $path )
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.
get_backends ( )
Returns a reference to the internal array of configured backend instances.
DEPENDENCIES
File::VirusScan::Engine, File::VirusScan::Result
AUTHOR
Dave O'Neill (dmo@roaringpenguin.com)
Dianne Skoll (dfs@roaringpenguin.com>
LICENCE AND COPYRIGHT
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.