Project

clamrb

0.0
No commit activity in last 3 years
No release in over 3 years
Native Ruby extension for running clamav scans
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.16
~> 10.0
~> 3.2

Runtime

 Project Readme

clamrb Build Status Gem Gem Version

This project is a Ruby gem that interfaces with the Clam AV engine using libclamav.

Installation

Add this line to your application's Gemfile:

gem 'clamrb'

And then execute:

$ bundle

Or install it yourself as:

$ gem install foo

Usage

To create an instance of Clamrb and scan a file use the following example:

clamrb = Clamrb.new
result = clamrb.scan "file.txt"
 => #<Clamrb::Result:0x00000000012d2458 @status=:infected, @identifier="Eicar-Test-Signature">

There are convenience predicate methods on the Clamrb::Result object returned from the scan. These methods allow you to quickly determine the status of the file:

result.safe?
=> false
result.error?
=> false
result.virus?
=> true

Performance

Creating a new instance of Clamrb causes ClamAV to load its database and initialize its engine. This can take a few seconds in some scenarios. To keep your application performing well you should create an instance of Clamrb during the startup sequence of your application and reuse it for your scans to keep overall scan latency to a minimum.

Dependencies

This gem does not have any ruby dependencies, however, it does rely on some external libraries on the system. To install clamrb you will need a compiler and the associated tools for building native ruby gems, clamav, libclamav, and the associated headers. You can review the docker folder to see which dependencies are necessary to install and run this library.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/abedra/clamrb.