c# - nClam - 如何将 linux 服务器路径传递给 ScanFileOnServer

标签 c# ubuntu clam nclam

我已经设置 ClamAv 在 Ubuntu VM (VirtualBox) 内的 docker 容器中运行。我已经编写了以下 C# 程序(从我的 Windows 主机运行)并且能够成功扫描我的 Windows 机器中的本地文件(SendAndScanFileAsync),因为 192.168.0.103:3310(Guest Ububtu 中的 ClamAv)可以从主机 Windows 访问。

我想使用 ScanFileOnServerAsync 方法扫描 Linux 服务器的 Downloads 文件夹中的文件,但我无法这样做,因为我不确定如何在以下代码中指定 Linux 路径。请帮忙。

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 服务器路径:/home/{user}/Downloads

无论我指定的路径格式是什么,我总是会收到此错误 - “下载:lstat() 失败:没有这样的文件或目录。错误”

最佳答案

尝试指定完整的文件路径,如 "/home/username/Downloads/filename.ext" .

关于c# - nClam - 如何将 linux 服务器路径传递给 ScanFileOnServer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58677534/

相关文章:

c# - 将参数传递给 SQL select 语句 IN 子句的行为很奇怪。

c# - 将 winform 插件添加到 Word 中的自定义任务 Pane

c# - ASP.NET 网络 API : any downsides to asynchronous operations?

clam - 无法停止 Linux 中的 Clamav 守护进程

c# - 远程MySQL访问耗时较长

python - 如何防止系统挂起/锁定(Python/C/Bash)

ubuntu - 如何在 ubuntu 17.04 中将我的 gcc 6.3.0 更新为 gcc 7.1.0

python - 可以存储在内存中的函数

使用clamav扫描php文件上传,权限在/tmp/