Giter Site home page Giter Site logo

quahog's Introduction

Quahog

Build Status

Quahog is a simple PHP library to interface with the clamd anti-virus daemon. It was written as all of the libraries out there for interfacing with ClamAV from PHP use exec('clamscan'), which isn't exactly an ideal solution, as clamscan loads the entire database into memory each time it is run - this doesn't, so it scans a lot (lot!) faster.

Installation

It is recommended to install Quahog through composer.

{
    "require": {
        "blurgroup/quahog": "0.*"
    }
}

Usage

// Create a new socket instance in PHP 5.3
$factory = new \Socket\Raw\Factory();
$socket = $factory->createClient('unix:///var/run/clamav/clamd.ctl');

// Create a new socket instance in PHP >=5.4
$socket = (new \Socket\Raw\Factory())->createClient('unix:///var/run/clamav/clamd.ctl');

// Create a new instance of the Client
$quahog = new \Quahog\Client($socket);

// Scan a file
$result = $quahog->scanFile('/tmp/virusfile');

// Scan a file or directory recursively
$result = $quahog->contScan('/tmp/virusdirectory');

// Scan a file or directory recursively using multiple threads
$result = $quahog->multiscanFile('/tmp/virusdirectory');

// Scan a stream, and optionally pass the maximum chunk size in bytes
$result = $quahog->scanStream(file_get_contents('/tmp/virusfile'), 1024);

// Ping clamd
$result = $quahog->ping();

// Get ClamAV version details
$result = $quahog->version();

// View statistics about the ClamAV scan queue
$result = $quahog->stats();

// Reload the virus database
$quahog->reload();

// Shutdown clamd cleanly
$quahog->shutdown();

Testing

To run the test suite you will need PHPUnit installed. Go to the project root and run:

$ phpunit

Credits

blur Group

Jonjo McKay and blur Group

License

Quahog is released under the MIT License

quahog's People

Contributors

jonjo-blur avatar jonjomckay avatar jchamberlain avatar gimler avatar theonlymerlin avatar lbialy avatar

Watchers

James Cloos 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.