Catalog PyPI
PACKAGE EXPLORERView in registry

aioclamd

PyPI

Asynchronous client for virus scanning with ClamAV

clamavscanningvirus
Versions collected1
Direct dependencies5From release 1.1.0
Last observed21 Oct, 11:43 UTC

README

Version 1.1.0 documentation

aioclamd

This package is an asynchronous version of the pleasant package python-clamd. It has the same external API, only all methods are coroutines and all communication is handled asynchronously using the asyncio framework.

The ClamdAsyncClient connects to a ClamAV antivirus instance and scans files and data for malicious threats. This package does not bundle ClamAV in any way, so a running instance of the clamd deamon is required.

Installation

pip install aioclamd

Usage

To scan a file (on the system where ClamAV is installed):

import asyncio

from aioclamd import ClamdAsyncClient

async def main(host, port):
    clamd = ClamdAsyncClient(host, port)
    print(await clamd.scan('/etc/clamav/clamd.conf'))

asyncio.run(main("127.0.0.1", 3310))

# Output:
# {'/etc/clamav/clamd.conf': ('OK', None)}

To scan a data stream:

import asyncio
import base64
from io import BytesIO

from aioclamd import ClamdAsyncClient

EICAR = BytesIO(
    base64.b64decode(
        b"WDVPIVAlQEFQWzRcUFpYNTQoUF4pN0NDKTd9JEVJQ0FSLVNU"
        b"QU5EQVJELUFOVElWSVJVUy1URVNU\nLUZJTEUhJEgrSCo=\n"
    )
)

async def main(host, port):
    clamd = ClamdAsyncClient(host, port)
    print(await clamd.instream(EICAR))

asyncio.run(main("127.0.0.1", 3310))

# Output:
# {'stream': ('FOUND', 'Win.Test.EICAR_HDB-1')}

Development

This repo ships a Dockerfile that bundles a clamd instance together with this package itself, for local development and integration testing:

docker build -t aioclamd-dev .
docker run --rm -p 127.0.0.1:3310:3310 aioclamd-dev

Only ever publish the port to loopback (127.0.0.1:3310:3310), never to 0.0.0.0 or a public interface. clamd's TCP protocol is unauthenticated and unencrypted by design (this is documented upstream ClamAV behavior, not specific to this image) -- treat it as safe only on loopback or within a fully trusted internal network, never across an untrusted network.

Alternatively, if you just want a bare clamd without the packaged client, the official upstream image works standalone:

docker run -p 3310:3310 --rm clamav/clamav

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
1.1.017 Sept 20265

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
hbldh/aioclamd

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 11:43 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:05f403ea047af8fb325b26845f53835d1f061c837124118182bb70d6e3f223a8