I have set up ClamAv running in a docker container inside Ubuntu VM (VirtualBox). I have written the following C# program (running from my Windows Host) and able to scan local files in my windows machine successfully (SendAndScanFileAsync) as 192.168.0.103:3310 (ClamAv in Guest Ububtu) is accessible from Host Windows.
I want to scan the files on Linux server's Downloads folder using ScanFileOnServerAsync method but I am unable to do as I am not sure how to specify the Linux path in the following code. Please help.
namespace ClamAvDemo
{
class Program
{
static void Main(string[] args)
{
var clam = new ClamClient("192.168.0.103", 3310);
var scanResult = clam.ScanFileOnServerAsync("Downloads"); // Downloads is a folder in Linux Server running as a VM
switch (scanResult.Result.Result)
{
case ClamScanResults.Clean:
Console.WriteLine("The file is clean!");
break;
case ClamScanResults.VirusDetected:
Console.WriteLine("Virus Found!");
Console.WriteLine("Virus name: {0}", scanResult.Result.InfectedFiles.First().VirusName);
break;
case ClamScanResults.Error:
Console.WriteLine("Woah an error occured! Error: {0}", scanResult.Result.RawResult);
break;
}
}
}
}
Linux server path to scan: /home/{user}/Downloads
Whatever be the path format I specify, I always get this error - "Downloads: lstat() failed: No such file or directory. ERROR"
Try to specify the full file path, like
"/home/username/Downloads/filename.ext"
.