kylefarris / clamscan

A robust ClamAV virus scanning library supporting scanning files, directories, and streams with local sockets, local/remote TCP, and local clamscan/clamdscan binaries (with failover).
MIT License
236 stars 69 forks source link

Getting Error while running clamdscan #23

Closed sripreddyg closed 5 years ago

sripreddyg commented 6 years ago

Can someone help to on why I am getting below error while using clamdscan though clamscan working fine.

Error: Error: Command failed: /usr/local/bin/clamdscan --no-summary --fdpass --config-file=/usr/local/etc/clamav/clamd.conf --multiscan /Users/xxxxx/POC/dog.jpeg

Below is test code I am using

var clam = require('clamscan')({
  remove_infected: false, // If true, removes infected files
  quarantine_infected: false, // False: Don't quarantine, Path: Moves files to this place.
  scan_log: null, // Path to a writeable log file to write scan results into
  debug_mode: false, // Whether or not to log info/debug/error msgs to the console
  file_list: null, // path to file containing list of files to scan (for scan_files method)
  scan_recursively: true, // If true, deep scan folders recursively
  clamscan: {
    path: '/usr/local/bin/clamscan', // Path to clamscan binary on your server
    db: null, // Path to a custom virus definition database
    scan_archives: true, // If true, scan archives (ex. zip, rar, tar, dmg, iso, etc...)
    active: true, // If true, this module will consider using the clamscan binary,
    multiscan: true
  },
  clamdscan: {
    path: '/usr/local/bin/clamdscan', // Path to the clamdscan binary on your server
    config_file: '/usr/local/etc/clamav/clamd.conf', // Specify config file if it's in an unusual place
    multiscan: true, // Scan using all available cores! Yay!
    reload_db: false, // If true, will re-load the DB on every call (slow)
    active: true // If true, this module will consider using the clamdscan binary
  },
  preference: 'clamdscan' // If clamdscan is found and active, it will be used by default
});

clam.is_infected('/Users/xxxxx/POC/dog.jpeg', function(err, file, is_infected) {
  if(err) {
    console.log(err);
    return false;
  }

  if(is_infected) {
    console.log({msg: "File is infected!"});
  } else {
    console.log({msg: "File is clean!"});
  }
});
kylefarris commented 5 years ago

Do you have have clamd installed on your server? "Command Failed" isn't exactly enough info to help you further than that. It could be a permissions issue.

arthi810 commented 5 months ago

Hi, I'm also facing the same issue. What's the fix ?

kylefarris commented 5 months ago

@arthi810 What specific issue are you having? Could be any number of things. Can you provide some details?