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
230 stars 68 forks source link

No/Empty Response #118

Closed gausss closed 7 months ago

gausss commented 7 months ago

Hi,

I'm trying to get this to work using a remote TCP connection. Testing locally right now.

  const clamscan = await new NodeClam().init({
    debugMode: true,
    clamdscan: {host: '127.0.0.1', port: 3310, localFallback: false},
  });
  const version = await clamscan.getVersion();
  console.log(version);
  const result = await clamscan.scanStream(eicarReadble);
  console.log(result);

Connection and everything seems fine.

node-clam: using remote server: 127.0.0.1:3310
node-clam: Established connection to clamscan server!
node-clam: PONG!
node-clam: Established connection to clamscan server!
node-clam: Attempting to establish socket/TCP connection for "getVersion"
node-clam: Socket/Host connection closed.
node-clam: using remote server: 127.0.0.1:3310
ClamAV 1.2.1/27175/Sun Feb  4 09:36:45 2024

node-clam: Provided stream is readable.
node-clam: Attempting to establish socket/TCP connection for "scanStream"
node-clam: Socket/Host connection closed.
node-clam: using remote server: 127.0.0.1:3310
node-clam: Received final data from stream.
node-clam: The input stream has dried up.
node-clam: ClamAV is done scanning.
node-clam: Raw Response:   
node-clam: Error Response:  
node-clam: File may be INFECTED!
{
  isInfected: null,
  viruses: [],
  file: null,
  resultString: '',
  timeout: false
}

But I can see in the logs of clam that it recognizes the eicar test file

Wed Feb 7 16:11:02 2024 -> instream(192.168.65.1@49265): Win.Test.EICAR_HDB-1 FOUND

Somehow I geet the same empty/default response no matter which file I put in. Something must be wrong. I also tried different clamav versions.

gausss commented 7 months ago

My port mapping was wrong.