Skip to content

jitbit/WinDefender

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

WinDefender - Windows Defender C# API

Invokes Windows Defender scan from C# .NET Core 6 (on Windows). Works even in ASP.NET

Usage

Add this file to your project then call:

//check by filename
bool isVirus = await WinDefender.IsVirus(@"c:\path\to\file");

//check by byte array
byte[] fileContents = ReadFileFromSomewhere();
bool isVirus = await WinDefender.IsVirus(fileContents);

//cancellation token support if you want ot abort
bool isVirus = await WinDefender.IsVirus(fileContents, cancellationToken);

Background

Windows defender comes with a CLI tool. It does not launch the actual antivirus process, it's just a CLI-API to the antivirus that is always running. Even if you have "real time protection" disabled (recommended for server environment) the CLI still works.

About

Invoke Windows Defender scan from C# .NET Core

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages