tatupesonen / clamav-client

ClamAV TCP client for Rust

Home Page:https://crates.io/crates/clamav-tcp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

clamav-tcp

A simple to use TCP client for scanning files with ClamAV.

Tests

There is an example docker-compose.yml file that sets up ClamAV for you. It is required to run the tests.

To run tests:

cargo test

Usage

You can pass anything that implements &mut Read to clamav-tcp.

eg. to scan a file

let mut eicar = std::fs::File::open("resources/eicar.txt").unwrap();
let res = scan("localhost:3310", &mut eicar, None).unwrap();
assert_eq!(res, "stream: Win.Test.EICAR_HDB-1 FOUND\0");

To scan a string:

let mut eicar = r"X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*".as_bytes();
let res = scan("localhost:3310", &mut eicar, None).unwrap();
assert_eq!(res, "stream: Win.Test.EICAR_HDB-1 FOUND\0");

Documentation

To open the documentation:

cargo doc --open

About

ClamAV TCP client for Rust

https://crates.io/crates/clamav-tcp

License:MIT License


Languages

Language:Rust 100.0%