https://github.com/tkasuz/libclamav-py
libclamav-py is a Python library that provides a seamless interface to the ClamAV antivirus engine via libClamAV. This wrapper directly calls the C API of Libclamav
https://github.com/tkasuz/libclamav-py
clamav libclamav python
Last synced: 6 months ago
JSON representation
libclamav-py is a Python library that provides a seamless interface to the ClamAV antivirus engine via libClamAV. This wrapper directly calls the C API of Libclamav
- Host: GitHub
- URL: https://github.com/tkasuz/libclamav-py
- Owner: tkasuz
- License: gpl-2.0
- Created: 2024-12-12T13:36:23.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-03-03T03:39:23.000Z (7 months ago)
- Last Synced: 2025-03-27T23:32:56.481Z (7 months ago)
- Topics: clamav, libclamav, python
- Language: Python
- Homepage:
- Size: 97.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# libclamav-py
[](https://github.com/tkasuz/libclamav-py/actions/workflows/test.yaml)

libclamav-py is a Python wrapper for the ClamAV library, providing an interface to ClamAV's virus scanning capabilities.
## Features
- Directly invokes the C API of libclamav, so the clamd daemon doesn't need to be running on your machine
- Lambda Layer which libclamav is binded (TODO)## Installation
To install libclamav-py, use pip:
```sh
pip install libclamav-py
```## Usage
Here is a basic example of how to use libclamav-py:
```python
from libclamav_py.clamav import Client# Initialize the libclamav engine with the default setting
client = Client(libclamav_path="/lib/libclamav.so")# Or libclamav client can be initialized from clamd.conf
client = Client.from_clamd_conf(clamd_conf_path="/etc/clamd.conf", libclamav_path="/lib/libclamav.so")
``````python
# Load virus definitions
client.load_db()# Compile engine
client.compile_engine()# Scan a file
result = client.scan_file('/path/to/file')
if result:
print(f"Virus detected: {result}")
else:
print("No virus detected")
```## License
This project is licensed under the GPL-2.0 License. See the [LICENSE](LICENSE) file for details.## Acknowledgements
- [ClamAV](https://www.clamav.net/) for the virus scanning engine