Skip to main content

A Python wrapper around clamd, the ClamAV daemon

Project description

clamdpy

A Python wrapper around clamd, the ClamAV daemon.

This is a maintained and updated fork of https://github.com/graingert/python-clamd/, credit goes to the original developer(s).

Python versions PyPI version Ruff

Installation

Using pip:

pip install clamdpy

Usage

from io import BytesIO

from clamdpy import ClamdNetworkSocket

clamd = ClamdNetworkSocket(
    host="127.0.0.1",
    port=3310,
    timeout=15,
)

clamd.ping()
#> 'PONG'

clamd.version()
#> VersionInfo(version='ClamAV 0.103.9', signature=27065, signature_date=datetime(2023, 10, 18, 9, 49, 14))

# Raw response can be fetched as well:
clamd.version(raw=True)
#> 'ClamAV 0.103.9/27065/Wed Oct 18 09:49:14 2023'

clamd.instream(BytesIO(b"data"))
#> ScanResult(path='stream', reason=None, status='OK')

Most of the clamd commands are implemented (a couple ones are missing and should be implemented sooner or later).

It is possible to use UNIX sockets as well:

from clamdpy import ClamdUnixSocket

clamd = ClamdUnixSocket(path="/var/run/clamav/clamd.ctl")

Line delimitations

By default, \n will be used to terminate lines. Clamd also supports NULL characters:

from clamdpy import ClamdNetworkSocket

clamd = ClamdNetworkSocket(line_terminator="z")

[!WARNING]
Support for the NULL character isn't tested and may not work as it doesn't play well with Python. Use with caution.

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

clamdpy-0.2.0.tar.gz (24.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

clamdpy-0.2.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file clamdpy-0.2.0.tar.gz.

File metadata

  • Download URL: clamdpy-0.2.0.tar.gz
  • Upload date:
  • Size: 24.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for clamdpy-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6e157f49fc64dc239fe1f662db31009aca92b33486b3124b7863e808edf5cd1f
MD5 62fdb127349846f7c48598cf62b7bcc8
BLAKE2b-256 1f196f476637b3cda052c7fd1be5224b7d2f30c09dc5717c51c02145c145a51c

See more details on using hashes here.

File details

Details for the file clamdpy-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: clamdpy-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for clamdpy-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 51631e0455309f74090876cce989153729f7a5319ad89164f65ec5276759d584
MD5 3c756659d57550c473d01ac0aea61983
BLAKE2b-256 46053b20a4a4674e8a80cfcef97e7bb15c35b4937ca1e6502071d8796a6175bd

See more details on using hashes here.

Supported by

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