我正在尝试对上传的文件进行病毒扫描。我无法控制已安装的病毒扫描程序,该产品由多方使用不同的扫描程序托管。
我尝试了以下库,但它总是在 eicar 文件上返回 VirusNotFound。 https://antivirusscanner.codeplex.com/
你知道其他解决方案吗?
我正在尝试对上传的文件进行病毒扫描。我无法控制已安装的病毒扫描程序,该产品由多方使用不同的扫描程序托管。
我尝试了以下库,但它总是在 eicar 文件上返回 VirusNotFound。 https://antivirusscanner.codeplex.com/
你知道其他解决方案吗?
ClamAV 的检测分数很差。VirusTotal 不在本地。
我决定为多个扫描仪创建 CLI 包装器,可以在这里找到 nuget 包:https ://www.nuget.org/packages?q=avscan
其文档和源代码可在https://github.com/yolofy/AvScan获得
我将此库用于 .net(它使用 VirusTotal 公共 api):
https://github.com/Genbox/VirusTotal.NET
来自 github 的一个小例子:
static void Main(string[] args)
{
VirusTotal virusTotal = new VirusTotal("INSERT API KEY HERE");
//Use HTTPS instead of HTTP
virusTotal.UseTLS = true;
FileInfo fileInfo = new FileInfo("testfile.txt");
//Create a new file
File.WriteAllText(fileInfo.FullName, "This is a test file!");
//Check if the file has been scanned before.
Report fileReport = virusTotal.GetFileReport(fileInfo).First();
bool hasFileBeenScannedBefore = fileReport.ResponseCode == 1;
if (hasFileBeenScannedBefore)
{
Console.WriteLine(fileReport.ScanId);
}
else
{
ScanResult fileResults = virusTotal.ScanFile(fileInfo);
Console.WriteLine(fileResults.VerboseMsg);
}
}
一个完整的例子可以在这里找到:
https://github.com/Genbox/VirusTotal.NET/blob/master/VirusTotal.NET%20Client/Program.cs
蛤蜊AV很不错。 https://www.clamav.net/downloads
C# API 在这里: https ://github.com/michaelhans/Clamson/