2020-10-22 21:27:16 +03:00
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
using MalwareMultiScan.Backends.Backends.Abstracts;
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
|
|
|
namespace MalwareMultiScan.Backends.Backends.Implementations
|
|
|
|
{
|
|
|
|
public class SophosScanBackend : AbstractLocalProcessScanBackend
|
|
|
|
{
|
|
|
|
public SophosScanBackend(ILogger logger) : base(logger)
|
|
|
|
{
|
|
|
|
}
|
2020-10-23 11:11:19 +03:00
|
|
|
|
2020-10-22 21:27:16 +03:00
|
|
|
public override string Id { get; } = "sophos";
|
2020-10-23 11:11:19 +03:00
|
|
|
|
2020-10-22 21:27:16 +03:00
|
|
|
protected override string BackendPath { get; } = "/opt/sophos-av/bin/savscan";
|
|
|
|
|
|
|
|
protected override bool ThrowOnNonZeroExitCode { get; } = false;
|
|
|
|
|
|
|
|
protected override Regex MatchRegex { get; } =
|
|
|
|
new Regex(@">>> Virus '(?<threat>.*)' found in file .*", RegexOptions.Compiled | RegexOptions.Multiline);
|
|
|
|
|
|
|
|
protected override string GetBackendArguments(string path)
|
|
|
|
{
|
|
|
|
return $"-f -archive -ss {path}";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|