Skip to content

Rust async tokio client for clamd. Works with a tcp socket or with the unix socket. At the moment it will open a new socket for each command. Work in progress.

License

Notifications You must be signed in to change notification settings

LevitatingOrange/clamd-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

clamd-client, WIP

Rust async tokio client for clamd. Works with a tcp socket or with the unix socket. At the moment it will open a new socket for each command. Work in progress.

Example

See also examples/simple.rs. There should be a running clamd instance on your machine (see Notes).

use clamd_client::{ClamdClientBuilder, ScanResult};

#[tokio::main]
async fn main() -> eyre::Result<()> {

    let address = "127.0.0.1:3310";
    let mut clamd_client = ClamdClientBuilder::tcp_socket(address)?.build();

    let eicar_bytes = reqwest::get("https://secure.eicar.org/eicarcom2.zip")
        .await?
        .bytes()
        .await?;

    let result = clamd_client.scan_bytes(&eicar_bytes).await?;
    match result {
        ScanResult::Malignent { infection_types } => {
            tracing::debug!("clamd found a virus(es):\n{}", infection_types.join("\n"))
        }
        _ => (),
    };
    Ok(())
}

Contributing

testing

clamd is not installed

Simply run cargo test and it should install clamd for you.

Notes

TODOS

  • Implement missing clamd functionality
  • check whether this can also be used with other async runtimes

About

Rust async tokio client for clamd. Works with a tcp socket or with the unix socket. At the moment it will open a new socket for each command. Work in progress.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages