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).
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 theNULLcharacter isn't tested and may not work as it doesn't play well with Python. Use with caution.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file clamdpy-0.1.0.post1.tar.gz.
File metadata
- Download URL: clamdpy-0.1.0.post1.tar.gz
- Upload date:
- Size: 10.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17ba3cdd4853d1f7b41e07aec45d95a94bf29543d92b18fc17dc737c1e26588a
|
|
| MD5 |
9240f6baa3a8c06a8eb083f1fded8910
|
|
| BLAKE2b-256 |
a1639713bd02530c7b1881a3bbc4faa54756160cae6a57de0024574c5575aa44
|
File details
Details for the file clamdpy-0.1.0.post1-py3-none-any.whl.
File metadata
- Download URL: clamdpy-0.1.0.post1-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c83dde4f8574e5340fb3f0cabf312c08782baec8481e15db57673c5616ab404
|
|
| MD5 |
4e8afc0283e7320a2d576f59fd4070e6
|
|
| BLAKE2b-256 |
76035acaf4d053d5bf74fb6b7559c7de0bbf2143392eaa724394b2e2d2f17ede
|