Skip to main content

django-clamd is a django integration with Clamd (Clamav daemon).

Project description

This project integrates python-clamd with Django for easy scanning files for viruses on upload

Install

From PyPi with pip:

pip install django-clamd

or

easy_install django-clamd

You can also install development version direclty from GitHub:

pip install git+https://github.com/vstoykov/django-clamd.git

Aditioanlly if you want translations to work you need to add it to installed apps.

INSTALLED_APPS = (
    ...
    'django_clamd',
    ...
)

Usage

You can use it in forms:

from django import forms
from django_clamd.validators import validate_file_infection

class UploadForm(forms.Form):
    upload_file = forms.FileField(validators=[validate_file_infection])

Or you can add it as validator directly in your model:

from django.db import models
from django_clamd.validators import validate_file_infection

class FileModel(models.Model):
    document = models.FileField(validators=[validate_file_infection])

You will have automatically scanning of upladed files in Django Admin and also when create ModelForm’s for that model.

Configuration

By default django-clamd tries to be smart and with good defaults. You can still configure how to connect to Clamd. Default values are:

CLAMD_SOCKET = '/var/run/clamav/clamd.ctl'
CLAMD_USE_TCP = False
CLAMD_TCP_SOCKET = 3310
CLAMD_TCP_ADDR = '127.0.0.1'

Note: When you are running on Fedora or CentOS and clamav-scanner package is installed then default value for CLAMD_SOCKET is:

CLAMD_SOCKET = '/var/run/clamd.scan/clamd.sock'

You also can disable virus scanning for development with:

CLAMD_ENABLED = False

Note: This is primary for make it easy to run a project on development without the need of installing Clamd on devlopment machine.

License

django-clamd is released as open-source software under the LGPL license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-clamd-0.3.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

django_clamd-0.3.0-py2.py3-none-any.whl (9.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file django-clamd-0.3.0.tar.gz.

File metadata

  • Download URL: django-clamd-0.3.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for django-clamd-0.3.0.tar.gz
Algorithm Hash digest
SHA256 7d77051dd298538aeb33d2c36d1fcb262f11a9328eb634427b6f41e3b549b596
MD5 6ea8722b455ddb1b90e69ce9f65ff31b
BLAKE2b-256 09eb2b2d5569a5fccd59bbf162e8b811e796c0d44254870c3b8d0197fe95a7c3

See more details on using hashes here.

File details

Details for the file django_clamd-0.3.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_clamd-0.3.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 537f4ae7e909b4d65b10d3dbc9b23e826b679201ddcb2d227f0a729ce1d751fb
MD5 3d59f9e9a4880bb9c3f392212f6f3018
BLAKE2b-256 39e2471df83e13191e45fe3b7b5d53b8a16d28071cfc07a8ca44d8f77bd234a8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page