Asyncio python clamav client library
Ping
pvs = await PyvalveNetwork()
response = await pvs.ping()
ClamAv will respond with "PONG"
Scanning
pvs = await PyvalveNetwork()
response = await pvs.scan(path)
Stream Scanning
from io import BytesIO
from aiofile import AIOFile
buffer = BytesIO()
async with AIOFile('some/file', 'r') as file_pointer:
line = await file_pointer.read_bytes()
buffer.write(line)
buffer.seek(0)
response = await pvs.instream(buffer)
Bases: object
Pyvalve base class
Set persistent connection
-
Parameters
bool (persist) – persistent connection True/False
-
Return type
None
Set stream buffer
-
Parameters
int (length) – Desired stream buffer in bytes
-
Return type
None
Send allmatchscan command
-
Parameters
str (path) – Path to file/directory to be scanned
-
Returns
Response from clamav
-
Return type
str
-
Raises
PyvalveScanningError – If path is not found
Send constscan command
-
Parameters
str (path) – Path to file/directory to be scanned
-
Returns
Response from clamav
-
Return type
str
-
Raises
PyvalveScanningError – If path is not found
Send a stream to clamav
-
Parameters
buffer (BinaryIO) – a buffer object
-
Returns
Response from clamav
-
Return type
str
-
Raises
-
PyvalveConnectionError – If connection is broken
-
PyvalveStreamMaxLength – If stream size limit exceeded
-
Send multiscan command
-
Parameters
str (path) – Path to file/directory to be scanned
-
Returns
Response from clamav
-
Return type
str
-
Raises
PyvalveScanningError – If path is not found
Send ping command
-
Returns
Response from clamav
-
Return type
str
Send reload command
-
Returns
Response from clamav
-
Return type
str
Send scan command
-
Parameters
str (path) – Path to file/directory to be scanned
-
Returns
Response from clamav
-
Return type
str
-
Raises
PyvalveScanningError – If path is not found
Send shutdown command
-
Returns
Response from clamav
-
Return type
str
Send stats command
-
Returns
Response from clamav
-
Return type
str
Send version command
-
Returns
Response from clamav
-
Return type
str
Bases: Pyvalve
Asyncio Clamd network client
PyvalveNetwork Constructor
-
Parameters
-
str (host) – host address for clamav
-
int (timeout) – listening port for clamav
-
int – socket timemout
-
Bases: Pyvalve
Asyncio Clamd socket client
PyvalveSocket Constructor
-
Parameters
-
str (socket) – Path to socket file
-
int (timeout) – socket timemout
-
Bases: Exception
Pyvalve exception base class
Bases: PyvalveError
Exception communicating with clamd
Bases: PyvalveError
Exception processing response
Bases: PyvalveError
Exception scanning. Could be path not found.
Bases: PyvalveResponseError
Exception using INSTREAM with a buffer length > StreamMaxLength in /etc/clamav/clamd.conf