Translations: fr

pyClamd : Clamav with python

About

Logo pyClamd

pyClamd is a python interface to Clamd (ClamAV antivirus daemon). By using pyClamd, you can add virus detection capabilities to your python software in an efficient and easy way.

Instead of pyClamav which uses libclamav, pyClamd may be used by a closed source product.

Download latest

pyClamd-0.3.17.tar.gz - 2016-02-17

md5sum : 701e63618e04f94d956e99e43372cf84

This version is compatible with python 3 (tested with 3.4.3) and python 2 (tested 2.7.3).

The API for this new version is now object oriented. Usefull classes are ClamdNetworkSocket and ClamdUnixSocket.

You can alway check documentation with :

pydoc pyclamd

Previous version

This version provides old API (functions) pyclamd_0.2.2.py - 2010-07-12
md5sum is f7b7a5bb2839bc3343735bc095f40aa9

Download development version

Get source from the code repository.

hg clone https://bitbucket.org/xael/pyclamd

Bug report : http://bitbucket.org/xael/pyclamd/issues

Installation

These are generic installation instructions.

You need to have clamav with clamd installed. You also need to have python installed. Clamd should be accessible either by network or by unix socket.

Install from PIP

Installing pyClamd is just as simple as:

pip install pyclamd

Manual installation

You just have to copy pyclamd.py in your site-packages directory (for example : /usr/lib/python2.3/site-packages/).

python setup.py install

Or if you do not want a wide system installation, you can copy pyclamd.py in your application directory.

Usage

From python :

>>> import pyclamd
>>> cd = pyclamd.ClamdAgnostic()
>>> cd.ping()
True
>>> print(cd.version().split()[0])
ClamAV
>>> print(cd.reload())
RELOADING
>>> print(cd.stats().split()[0])
POOLS:
>>> void = open('/tmp/EICAR','w').write(cd.EICAR())
>>> void = open('/tmp/NO_EICAR','w').write('no virus in this file')
>>> cd.scan_file('/tmp/EICAR')
{'/tmp/EICAR': ('FOUND', 'Eicar-Test-Signature')}
>>> cd.scan_file('/tmp/NO_EICAR') is None
True
>>> cd.scan_stream(cd.EICAR())
{'stream': ('FOUND', 'Eicar-Test-Signature')}

Full documentation

Full documentation for pyclamd is available here.

License

This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 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 Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.