pyClamAV is a python binding to libclamav written in C. By using pyClamAV, you can add virus detection capabilities to your python software in an efficient and easy way.
Has been tested to works with libclamav up to version 0.93.0 (and may be later versions)
The simplest way to compile this package is:
apt-get install python-clamav
Debian Package maintained by Cédric Delfosse
Python 2.3.3 (#1, Mar 21 2004, 00:29:15) [GCC 2.95.4 20011002 (Debian prerelease)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import pyclamav >>> ret=pyclamav.scanfile('/tmp/virus') >>> print ret (1, 'Worm.Sober.G') >>> ret=pyclamav.scanthis("Buffer to test blalblabla...") >>> print ret (0, '') >>> print pyclamav.get_numsig() 34861 >>> print pyclamav.get_version() ('0.86.1', 898, 1117257063) >>> print pyclamav.version() 0.3.0 >>> print pyclamav.scanfile('/tmp') # /tmp is a directory Traceback (most recent call last): File "
", line 1, in ? ValueError: Argument is not a filename
>>> pyclamav.scanfile('/tmp/virus.txt') (1, 'Eicar-Test-Signature') >>> pyclamav.scanfile('/tmp/novirus.txt') (0, '')
>>> pyclamav.scanthis(virus_string) (1, 'Eicar-Test-Signature') >>> pyclamav.scanthis(no_virus_string) (0, '')
Beware using scanthis for scanning a buffer is less secure than scanning a file. For example, Trojan.SubSeven.20 is not detected using buffer scanning. This is due to a bug/functionnality no yet implemented in libclamav 0.86 and earlier. - Thanks to Michael Lang for pointing this out.
>>> pyclamav.version() '0.3.1'
>>> pyclamav.get_version() ('0.84', 1304, 1140954448)
>>> pyclamav.get_numsig() 45686
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.