django-clamd
=============
This project integrates python-clamd with Django for easy scanning files for viruses on upload
Install
-------
From PyPi with pip:
.. code-block:: bash
pip install django-clamd
or
.. code-block:: bash
easy_install django-clamd
You can also install development version direclty from GitHub:
.. code-block:: bash
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.
.. code-block:: python
INSTALLED_APPS = (
...
'django_clamd',
...
)
Additionally if you are using Ubuntu, in order for django-clamd to work install clamav-daemon.
.. code-block:: bash
sudo apt-get install clamav-daemon
Usage
-----
You can use it in forms:
.. code-block:: python
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:
.. code-block:: python
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 :code:`django-clamd` tries to be smart and with good defaults.
You can still configure how to connect to Clamd. Default values are:
.. code-block:: python
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 :code:`clamav-scanner`
package is installed then default value for :code:`CLAMD_SOCKET` is:
.. code-block:: python
CLAMD_SOCKET = '/var/run/clamd.scan/clamd.sock'
By default, this package will *allow* a file if ClamD cannot be contacted or
if the scan fails. If you want validation to fail in these instances, change
:code:`CLAMD_FAIL_BY_DEFAULT`
.. code-block:: python
CLAMD_FAIL_BY_DEFAULT = True
You also can disable virus scanning for development with:
.. code-block:: python
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.
Raw data
{
"_id": null,
"home_page": "https://github.com/vstoykov/django-clamd",
"name": "django-clamd",
"maintainer": "Venelin Stoykov",
"docs_url": null,
"requires_python": null,
"maintainer_email": "vkstoykov@gmail.com",
"keywords": "python, django, clamav, antivirus, scanner, virus, libclamav, clamd",
"author": "Venelin Stoykov",
"author_email": "vkstoykov@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/21/a9/b99c82906edb502eed580c1b8d93ce6efd540e48f7d5eb757921885c9b11/django_clamd-1.0.0.tar.gz",
"platform": null,
"description": "django-clamd\n=============\n\nThis project integrates python-clamd with Django for easy scanning files for viruses on upload\n\n\nInstall\n-------\n\nFrom PyPi with pip:\n\n.. code-block:: bash\n\n pip install django-clamd\n\nor\n\n.. code-block:: bash\n\n easy_install django-clamd\n\nYou can also install development version direclty from GitHub:\n\n.. code-block:: bash\n\n pip install git+https://github.com/vstoykov/django-clamd.git\n\n\nAditioanlly if you want translations to work you need to add it to installed apps.\n\n.. code-block:: python\n\n INSTALLED_APPS = (\n ...\n 'django_clamd',\n ...\n )\n \n \nAdditionally if you are using Ubuntu, in order for django-clamd to work install clamav-daemon.\n\n.. code-block:: bash\n\n sudo apt-get install clamav-daemon\n\n\nUsage\n-----\n\nYou can use it in forms:\n\n.. code-block:: python\n\n from django import forms\n from django_clamd.validators import validate_file_infection\n\n class UploadForm(forms.Form):\n upload_file = forms.FileField(validators=[validate_file_infection])\n\n\nOr you can add it as validator directly in your model:\n\n.. code-block:: python\n\n from django.db import models\n from django_clamd.validators import validate_file_infection\n\n class FileModel(models.Model):\n document = models.FileField(validators=[validate_file_infection])\n\n\nYou will have automatically scanning of upladed files in Django Admin\nand also when create ModelForm's for that model.\n\n\nConfiguration\n-------------\n\nBy default :code:`django-clamd` tries to be smart and with good defaults.\nYou can still configure how to connect to Clamd. Default values are:\n\n.. code-block:: python\n\n CLAMD_SOCKET = '/var/run/clamav/clamd.ctl'\n CLAMD_USE_TCP = False\n CLAMD_TCP_SOCKET = 3310\n CLAMD_TCP_ADDR = '127.0.0.1'\n\nNote: When you are running on Fedora or CentOS and :code:`clamav-scanner`\npackage is installed then default value for :code:`CLAMD_SOCKET` is:\n\n.. code-block:: python\n\n CLAMD_SOCKET = '/var/run/clamd.scan/clamd.sock'\n\nBy default, this package will *allow* a file if ClamD cannot be contacted or\nif the scan fails. If you want validation to fail in these instances, change\n:code:`CLAMD_FAIL_BY_DEFAULT`\n\n.. code-block:: python\n\n CLAMD_FAIL_BY_DEFAULT = True\n\nYou also can disable virus scanning for development with:\n\n.. code-block:: python\n\n CLAMD_ENABLED = False\n\nNote: This is primary for make it easy to run a project on development without\nthe need of installing Clamd on devlopment machine.\n\n\nLicense\n-------\n`django-clamd` is released as open-source software under the LGPL license.\n",
"bugtrack_url": null,
"license": null,
"summary": "django-clamd is a django integration with Clamd (Clamav daemon).",
"version": "1.0.0",
"project_urls": {
"Download": "https://github.com/vstoykov/django-clamd/releases",
"Homepage": "https://github.com/vstoykov/django-clamd"
},
"split_keywords": [
"python",
" django",
" clamav",
" antivirus",
" scanner",
" virus",
" libclamav",
" clamd"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "994c369fc0bae4ba3da0fcfd41f5e43a6929b119d8d4211c7ae36ac5453706ec",
"md5": "826b5f89384f6d601f2c27b490f0dfda",
"sha256": "ee2d46ed535355aa0840f93dd8468bf9e2236e2a54ea2affa956e5c9326e328a"
},
"downloads": -1,
"filename": "django_clamd-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "826b5f89384f6d601f2c27b490f0dfda",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 9719,
"upload_time": "2024-06-19T21:52:38",
"upload_time_iso_8601": "2024-06-19T21:52:38.755667Z",
"url": "https://files.pythonhosted.org/packages/99/4c/369fc0bae4ba3da0fcfd41f5e43a6929b119d8d4211c7ae36ac5453706ec/django_clamd-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "21a9b99c82906edb502eed580c1b8d93ce6efd540e48f7d5eb757921885c9b11",
"md5": "c5ec6ad1ab48b62e5a58a63318b2358c",
"sha256": "106429a71db571b570c88493115891a5472623263d25ebe7f92bead6c2f04e81"
},
"downloads": -1,
"filename": "django_clamd-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "c5ec6ad1ab48b62e5a58a63318b2358c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 7589,
"upload_time": "2024-06-19T21:52:48",
"upload_time_iso_8601": "2024-06-19T21:52:48.253078Z",
"url": "https://files.pythonhosted.org/packages/21/a9/b99c82906edb502eed580c1b8d93ce6efd540e48f7d5eb757921885c9b11/django_clamd-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-19 21:52:48",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "vstoykov",
"github_project": "django-clamd",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "django-clamd"
}