.NET virus scanning API

前端 未结 11 2197
旧巷少年郎
旧巷少年郎 2020-11-28 06:27

I\'m building a web application in which I need to scan the user-uploaded files for viruses.

Does anyone with experience in building something like this can provide

11条回答
  •  粉色の甜心
    2020-11-28 07:13

    You can use IAttachmentExecute API.

    Windows OS provide the common API to calling the anti virus software which is installed (Of course, the anti virus software required support the API). But, the API to calling the anti virus software provide only COM Interface style, not supported IDispatch. So, calling this API is too difficult from any .NET language and script language.

    Download this library from here Anti Virus Scanner for .NET or add reference your VS project from "NuGet" AntiVirusScanner

    For example bellow code scan a file :

    var scanner = new AntiVirus.Scanner();
    var result = scanner.ScanAndClean(@"c:\some\file\path.txt");
    Console.WriteLine(result); // console output is "VirusNotFound".
    

提交回复
热议问题