Coder Social home page Coder Social logo

django-clamd-d4's Introduction

django-clamd

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.

django-clamd-d4's People

Contributors

vstoykov avatar emoitzi avatar pyup-bot avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.