GithubHelp home page GithubHelp logo

clamav-client's Introduction

clamav-client

Introduction

clamav-client is a simple, solid library in Java to communicate with ClamaAV daemon. You can send any message type (typically email) for ClamAV to check for viruses.

The library implements all commands, except which only works on UNIX domain sockets. You can find more information on clamd manual.

Maven dependency

<dependency>
    <groupId>hu.alphabox</groupId>
    <artifactId>clamav-client</artifactId>
    <version>0.1</version>
</dependency>

Building

To make the clamav-client-0.1-SNAPSHOT.jar, you will need the Apache Maven installed. Run the following command:

mvn clean package

Simple Usage

A simple usage example to send EICAR message with the simplest implementation.

public static void main(String[] args) throws Exception {
    ClamAVClient client = new ClamAVClient("localhost", 3310);
    //EICAR message string
    String message = "X5O!P%@AP[4\\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*";
    String reply = client.sendCommand(new InStreamCommand(message));
    LOGGER.info("Reply of the message: {}", reply);
}

Async usage

Send messages in async mode with only one connection (Session mode). You get the results as a Future.

public static void main(String[] args) throws Exception {
	List<Future<String>> result = new ArrayList<>();
	try (ClamAVAsyncSessionClient client = new ClamAVAsyncSessionClient("192.168.1.105", 3310)) {
		String message = "X5O!P%@AP[4\\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*";		
		for(int i = 0; i < 1000; i++) {
			result.add(client.sendCommand(new InStreamCommand(message)));
		}
		//Collections.shuffle(result);
		for(Future<String> future : result) {
			LOGGER.info(future.get());
		}
	}
}

License

This project licensed under Apache 2.0 License - see the LICENSE file for details

clamav-client's People

Contributors

mecseid avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.