Translations: en

pyClamd : utiliser Clamav avec python

À propos

Logo pyClamd

pyClamd est une interface python à Clamd (le serveur de l’antivirus ClamAV). En utilisant pyClamd, vous pouvez facilement et efficacement ajouter à vos programmes la capacité à détecter les virus.

Contrairement à pyClamav qui utilise libclamav, pyClamd peut-être utilisé pour un produit non opensource.

Télécharger la dernière version

pyClamd-0.4.0.tar.gz - 2017-08-27

md5sum : 176b00f50236fa11eaf1eb75ec8055d8

Cette version est compatible avec python 3 (tested with 3.4.3) et python 2 (tested 2.7.3).

L’API pour cette nouvelle version est maintenant orientée objets. Les classes utiles sont ClamdNetworkSocket et ClamdUnixSocket.

Vous pouver accèder à la documentation par :

pydoc pyclamd

Version précédente

Cette version fournie l’ancienne API (fonctions) pyclamd_0.2.2.py - 2010-07-12
md5sum : f7b7a5bb2839bc3343735bc095f40aa9

Télécharger la version de dévelopement

Le code source est disponible dans le dépôt de code.

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

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

Installation

Il est nécessaire d’avoir installé l’antivirus ClamAV avec le serveur clamd. Vous devez aussi avoir installé python. Clamd doit être accessible par le réseau ou par une socket unix.

Installation avec PIP

Installer pyClamd est aussi simple que :

pip install pyclamd

Installation manuelle

Vous avez juste à copier pyclamd.py dans le répertoire site-packages (par exemple : /usr/lib/python2.3/site-packages/).

python setup.py install

Ou si vous ne voulez pas d’installation sur le système, vous pouvez juste copier pyclamd.py dans le répertoire de votre application.

Utilisation

Depuis 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')}

Documentation complète

La documentation complète de pyClamd est disponible ici

Licence

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.