Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

clamscan

Package Overview
Dependencies
Maintainers
2
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clamscan - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

2

package.json
{
"name": "clamscan",
"version": "1.0.1",
"version": "1.0.2",
"author": "Kyle Farris <kfarris@chomponllc.com> (http://chomponllc.com)",

@@ -5,0 +5,0 @@ "description": "Use Node JS to scan files on your server with ClamAV's clamscan/clamdscan binary or via TCP to a remote server or local UNIX Domain socket. This is especially useful for scanning uploaded files provided by un-trusted sources.",

@@ -16,15 +16,10 @@ const fs = require('fs');

const bad_file_list = __dirname + '/bad_files_list.txt';
const bad_file = __dirname + '/bad_file.txt';
const passthru_file = __dirname + '/output';
const no_virus_url = 'https://raw.githubusercontent.com/kylefarris/clamscan/sockets/README.md';
const fake_virus_url = 'https://secure.eicar.org/eicar_com.txt';
const fake_virus_url2 = 'https://secure.eicar.org/eicarcom2.zip';
// Promisify some stuff
const prequest = promisify(request);
const fs_stat = promisify(fs.stat);
const fs_unlink = promisify(fs.unlink);
const fs_readfile = promisify(fs.readFile);
// Chai plugins
chai.use(chaiAsPromised);

@@ -51,3 +46,2 @@

process.on('unhandledRejection', (reason, p) => {
//console.log('Unhandled Rejection at: Promise', p, 'reason:', reason, 'stack:', reason.stack);
if (reason && typeof reason === 'object' && 'actual' in reason) {

@@ -73,6 +67,2 @@ console.log("Reason: ", reason.message, reason.actual);

// if (new_config.clamdscan.path === __dirname + '/should/not/exist') {
// console.log("New Config: ", new_config);
// }
return await new NodeClam().init(new_config);

@@ -339,3 +329,2 @@ } catch (err) {

expect(client).to.be.an('object');
// console.log("CLIENT: ", client);
expect(client.writable).to.eql(true);

@@ -347,3 +336,5 @@ expect(client.readable).to.eql(true);

});
it('should have the same timeout as the one configured through this module', async () => {
// TODO: earlier versions of Node (<=10.0.0) have no public way of determining the timeout
it.skip('should have the same timeout as the one configured through this module', async () => {
clamscan = await reset_clam({clamdscan: { timeout: 300000 }});

@@ -1074,6 +1065,6 @@ const client = await clamscan._init_socket();

clamscan.scan_dir(bad_scan_dir, (err, good_files, bad_files, viruses) => {
clamscan.scan_dir(bad_scan_dir, (err, _good_files, _bad_files, viruses) => {
check(done, () => {
expect(err).to.not.be.instanceof(Error);
expect(viruses).to.not.be.empty;
expect(viruses).to.not.be.empty
expect(viruses).to.be.an('array');

@@ -1080,0 +1071,0 @@ expect(viruses).to.have.length(1);

@@ -14,17 +14,2 @@ const fs = require('fs');

// return either $CLAMD_PATH or something like /usr/local/etc/clamav/clamd.conf
const findClamdConf = () => {
if (process.env.CLAMD_PATH) return process.env.CLAMD_PATH;
let clamdscan = which('clamdscan');
clamdscan = clamdscan.split(p.sep);
clamdscan.splice(-2, 2);
return p.sep + clamdscan.join(p.sep) + p.sep + 'etc/clamav/clamd.conf';
};
// Set socket to one default for TravisCI, another for anything else.
const socket = (process.env.CI ? '/var/run/clamav/clamd.ctl' : '/var/run/clamd.scan/clamd.sock');
// DRY
const path = which('clamscan');
module.exports = {

@@ -35,9 +20,9 @@ remove_infected: false, // don't change

clamscan: {
path, // required for testing
path: which('clamscan'), // required for testing
},
clamdscan: {
socket, // required for testing (change for your system) - can be set to null
socket: '/var/run/clamav/clamd.ctl', // required for testing (change for your system) - can be set to null
host: '127.0.0.1', // required for testing (change for your system) - can be set to null
port: 3310, // required for testing (change for your system) - can be set to null
path, // required for testing
path: which('clamdscan'), // required for testing
//config_file: '/etc/clamd.d/scan.conf' // set if required

@@ -44,0 +29,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc