0

我想在 Linux EC2 上使用 Clam AV 以编程方式扫描图像。我有以下配置。

const NodeClam = require("clamscan");
const config = {
    removeInfected: false, // If true, removes infected files
    quarantineInfected: false, // False: Don't quarantine, Path: Moves files to this place.
    scanLog: null, // Path to a writeable log file to write scan results into
    debugMode: false, // Whether or not to log info/debug/error msgs to the console
    fileList: null, // path to file containing list of files to scan (for scanFiles method)
    scanRecursively: true, // If true, deep scan folders recursively
    clamscan: {
        path: '/usr/bin/clamscan', // Path to clamscan binary on your server
        db: null, // Path to a custom virus definition database
        scanArchives: true, // If true, scan archives (ex. zip, rar, tar, dmg, iso, etc...)
        active: true // If true, this module will consider using the clamscan binary
    },
    clamdscan: {
        socket: false, // Socket file for connecting via TCP
        host: false, // IP of host to connect to TCP interface
        port: false, // Port of host to use when connecting via TCP interface
        timeout: 60000, // Timeout for scanning files
        localFallback: false, // Do no fail over to binary-method of scanning
        path: '/usr/bin/clamdscan', // Path to the clamdscan binary on your server
        configFile: null, // Specify config file if it's in an unusual place
        multiscan: true, // Scan using all available cores! Yay!
        reloadDb: false, // If true, will re-load the DB on every call (slow)
        active: true, // If true, this module will consider using the clamdscan binary
        bypassTest: false, // Check to see if socket is available when applicable
    },
    preference: 'clamdscan' // If clamdscan is found and active, it will be used by default
  };
  
  const ClamScan = new NodeClam().init(config);

  ClamScan.then(async (clamscan) => {
    try {
     
      const version = await clamscan.getVersion();
      console.log(`ClamAV Version: ${version}`);
      console.log(`Starting file scan........................}`);
      const { isInfected, file, viruses } = await clamscan.isInfected(req.file);
      if (isInfected) {
        console.log(`${file} is infected with ${viruses}!`);
      } else {

      }
    } catch (err) {
      return res.status(500).json({
        message: "Failure in scanning" + err,
      });
    }
  }).catch((err) => {
    return res.status(500).json({
      message: "Failure in ClamAV initialization" + err,
    });
  });

使用它并在 /usr/bin/clamscan 和 /usr/bin/clamdscan 中存在二进制文件后

出现以下错误:消息:“ClamAV 初始化失败错误:没有有效和活动的病毒扫描二进制文件处于活动状态且可用,并且未提供主机/套接字选项!

4

0 回答 0