2020-10-20 17:08:40 +03:00
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
using MalwareMultiScan.Backends.Backends.Abstracts;
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
|
|
|
namespace MalwareMultiScan.Backends.Backends.Implementations
|
|
|
|
{
|
|
|
|
public class ClamavScanBackend : AbstractLocalProcessScanBackend
|
|
|
|
{
|
|
|
|
public ClamavScanBackend(ILogger logger) : base(logger)
|
|
|
|
{
|
|
|
|
}
|
2020-10-23 11:11:19 +03:00
|
|
|
|
2020-10-20 17:10:13 +03:00
|
|
|
public override string Id { get; } = "clamav";
|
2020-10-23 11:11:19 +03:00
|
|
|
|
2020-10-20 17:08:40 +03:00
|
|
|
protected override string BackendPath { get; } = "/usr/bin/clamscan";
|
2020-10-23 11:11:19 +03:00
|
|
|
|
2020-10-20 17:08:40 +03:00
|
|
|
protected override Regex MatchRegex { get; } =
|
|
|
|
new Regex(@"(\S+): (?<threat>[\S]+) FOUND", RegexOptions.Compiled | RegexOptions.Multiline);
|
2020-10-22 14:15:27 +03:00
|
|
|
|
2020-10-26 16:20:47 +02:00
|
|
|
protected override bool ThrowOnNonZeroExitCode { get; } = false;
|
|
|
|
|
2020-10-20 17:08:40 +03:00
|
|
|
protected override string GetBackendArguments(string path)
|
|
|
|
{
|
|
|
|
return $"--no-summary {path}";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|