https://github.com/dmitriym09/py-clamav
LibClamAV ctypes binding
https://github.com/dmitriym09/py-clamav
antivirus clamav libclamav linux python python3 python38
Last synced: 6 months ago
JSON representation
LibClamAV ctypes binding
- Host: GitHub
- URL: https://github.com/dmitriym09/py-clamav
- Owner: dmitriym09
- License: mit
- Created: 2020-04-09T10:24:07.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-07-04T06:42:26.000Z (over 5 years ago)
- Last Synced: 2025-03-29T12:35:13.466Z (7 months ago)
- Topics: antivirus, clamav, libclamav, linux, python, python3, python38
- Language: Python
- Homepage:
- Size: 21.5 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# py-clamav
LibClamAV ctypes binding
## Docker
Check file by [docker container](https://hub.docker.com/r/dmitriym09/py-clamav)
```bash
docker run --rm -it -v{path_to_file}:{path_to_file} dmitriym09/py-clamav python -m py_clamav {path_to_file}
```## Install
- install or [download](https://www.clamav.net/downloads) libclamv
- `pip install py-clamav`## Using
```python
import osfrom py_clamav import ClamAvScanner
with ClamAvScanner() as scanner:
# scan file by path
path_file = 'path/to/file'
infected, virname = scanner.scan_file(path_file)
# scan file by fileno
fileno = os.memfd_create('testfile')
try:
os.write(fileno, b'data')
os.lseek(fileno, 0, 0)
infected, virname = scanner.scan_fileno(fileno)
finally:
os.close(fileno)
```