# lambda-av-scan

# Get ClamAV running on Mac OS X (using Homebrew)

The easiest way to get the ClamAV package is using [Homebrew](http://brew.sh/)

    $ brew install clamav

Before trying to start the `clamscan` process, you'll need a copy of the ClamAV databases.

Create a `freshclam.conf` file and configure as so

    # /usr/local/etc/freshclam.conf
    DatabaseMirror database.clamav.net

Then run

    $ freshclam -v

to download the ClamAV databases. The output will look something like this:

```
Current working dir is /usr/local/Cellar/clamav/<version>/share/clamav
Max retries == 3
ClamAV update process started at Tue Feb  4 11:31:22 2014
Using IPv6 aware code
Querying current.cvd.clamav.net
TTL: 1694
Software version from DNS: 0.98.1
Retrieving http://database.clamav.net/main.cvd
Trying to download http://database.clamav.net/main.cvd (IP: 81.91.100.173)
Downloading main.cvd [100%]
Loading signatures from main.cvd
Properly loaded 2424225 signatures from new main.cvd
main.cvd updated (version: 55, sigs: 2424225, f-level: 60, builder: neo)
Querying main.55.76.1.0.515B64AD.ping.clamav.net
...
```

To run the lambda locally or run tests you need to export the LAMBDA_TASK_ROOT

$ export LAMBDA_TASK_ROOT=/usr/local/Cellar/clamav/<version>
$ export CLAMAV_DB=/usr/local/Cellar/clamav/<version>/share/clamav

# gets the virus definitions
$ make virus_defs

$ LAMBDA_TASK_ROOT=/usr/local/Cellar/clamav/0.102.2 make test

The tests require two files in S3, any pdf called copies/safe.pdf in dev-orcd-podcast-output-assets and then the Eicar file called copies/eicar.pdf.  Here is how to create the eicar file which will fail a virus scanner.

$ echo 'X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*' > eicar.pdf