Rust ClamAV Client
A simple ClamAV client to stream files or in-memory data to clamd for antivirus scanning.
Please note: The functions ping_socket, scan_file_socket, and scan_buffer_socket are only available on Unix platforms.
Installation
Add this to your Cargo.toml:
[]
= "0.3.0"
To use the async functions in clamav_client::tokio, add this to your Cargo.toml:
[]
= { = "0.3.0", = ["tokio"] }
Usage
let clamd_host_address = "localhost:3310";
// Ping clamd to make sure the server is available and accepting TCP connections
let clamd_available = match ping_tcp ;
if !clamd_available
// Scan file for viruses
let file_path = "tests/eicar.txt";
let scan_file_response = scan_file_tcp.unwrap;
let file_clean = clean.unwrap;
if file_clean else
// Scan in-memory data for viruses
let buffer = br#"X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*"#;
let scan_buffer_response = scan_buffer_tcp.unwrap;
let data_clean = clean.unwrap;
if data_clean else