@oneteam/clamav
v1.0.1
Published
a network only clamd client
Downloads
8
Keywords
Readme
@oneteam/clamav
This is a nodejs network only client for clamav daemon using the INSTREAM command.
We have been using clamscan
with much success until file sizes started to get above 600MB at which point clamscan
starts to timeout. This module goes back to basic and only supports network operation (clamd doesn't need to be installed locally, it needs to be available on the network though).
To scan a file:
const { scanFile } = require("@oneteam/clamav");
//clamd must be available at 127.0.0.1/3310
const result = await scanFile("myFilePath");
// result.path: "myFilePath"
// result.status: "FOUND"
// result.virus: "Virus Name"
//or
// result.status: "OK" => all good
//or
// result.status: "ERROR" => something went wrong
To scan a stream (eg before saving a file):
const { ClamdNetworkSocket } = require("@oneteam/clamav");
const address = "127.0.0.1"; // your clamd server address
const port = "3310"; // your clamd port number
const cd = new ClamdNetworkSocket(address, port);
const myStream = ...;
const result = await cd.instream("stream name", myStream);
// result.path: "stream name"
// result.status: "FOUND"
// result.virus: "Virus Name"
//or
// result.status: "OK" => all good
//or
// result.status: "ERROR" => something went wrong
clamavCLI
node clamavCLI.js
print the helpnode clamavCLI.js samples
run the scan on samples in parallelnode clamavCLI.js eicar
create and run the scan on eicar filenode clamavCLI.js path/to/my/file
this will scanpath/to/my/file
Developers
To get started, make sure docker is installed.
This is setup to work on unix like systems, but mostly to get started, once you have generated the samples file, no need for that anymore.
./makeSamples.sh
to generate the samplesnpm run clamav
this will start the docker daemon with clamav using the provided config on first run the virus database will get downloadednpm run clamdtop
once the docker daemon is started, this will provide a view on the clamav instance best viewed on80x24
consolenpm test
run testsnpm run test:watch
run tests continuouslynpm run test:log
run tests with continuously debug logsnpm run test:samples
run a scan on the samples in parallel