AntiVirusScanner 1.0.2
dotnet add package AntiVirusScanner --version 1.0.2
NuGet\Install-Package AntiVirusScanner -Version 1.0.2
<PackageReference Include="AntiVirusScanner" Version="1.0.2" />
paket add AntiVirusScanner --version 1.0.2
#r "nuget: AntiVirusScanner, 1.0.2"
// Install AntiVirusScanner as a Cake Addin #addin nuget:?package=AntiVirusScanner&version=1.0.2 // Install AntiVirusScanner as a Cake Tool #tool nuget:?package=AntiVirusScanner&version=1.0.2
Anti Virus Scanner for .NET (and COM)
Project Description
This library allows you to scan files for viruses by any .NET languages (C#, F#, VB...), PowerShell, F# Script, WSH (JScript, VBScript), and any COM IDispatch client.
Quick Start
C#
- Download and add reference of this library to your C# project from "NuGet",
From Package Manager Console,
PM> Install-Package AntiVirusScanner
or dotnet CLI.
> dotnet add package AntiVirusScanner
- After installing this library, you can scan a file by C# code like this:
var scanner = new AntiVirus.Scanner();
var result = scanner.ScanAndClean(@"c:\some\file\path.txt");
Console.WriteLine(result); // console output is "VirusNotFound".
PowerShell
Donwload
AntiVirusScanner.dll
from download page.Enter commands in the PowerShell console, like this:
PS> [Reflection.Assembly]::LoadFrom("c:\some\folder\AntiVirusScanner.dll")
PS> $scanner = New-Object AntiVirus.Scanner
PS> $scanner.ScanAndClean("c:\some\file\path.txt")
VirusNotFound
F# Script
- Donwload
AntiVirusScanner.dll
from download page. - Write F# Script code like this, and run it.
// sample.fsx
#I "c:\some\folder"
#r "AntiVirusScanner.dll"
let scanner = new AntiVirus.Scanner()
scanner.ScanAndClean(@"c:\some\file\path.txt")
|> printfn "%O" // console output is "VirusNotFound".
VBScript
Donwload
AntiVirusScanner.dll
from download page, and runInstall as a COM server.bat
as adminstrator.Write VBScript code like this, and run it.
rem sample.vbs
Set scanner = CreateObject("AntiVirus.Scanner")
Set result = scanner.ScanAndClean("c:\some\file\path.txt")
WScript.Echo result
' console output is 0, means "VirusNotFound". 1 is "VirusFound" (may be cleaned), 2 is "FileNotExist".
System Requirements
- Windows OS (7 ~)
- .NET Framework (3.5 Client Profile ~) or .NET Core (2.0 ~) or .NET (5.0 ~)
- Any antivirus applications that support the "IAttachmentExecute" API.
Known list
- "Microsoft Security Essentials" on Win7Pro (x64)
- "ESET NOD32 AntiVirus 4.0" on Win7Pro (x86)
- "Windows Defender" on Win10Pro (x64)
Who virus-scan a file?
This library is a wrapper of an antivirus software product (such as "Microsoft Security Essentials") that you installed on your Windows OS.
Therefore, this library does not work if you do not install any antivirus software products on your Windows OS.
Why need this library?
Windows OS provides the standard API to call the antivirus software installed (Of course, the installed antivirus software has to support that API).
However, the Windows OS provided API exposes only COM Interface style, not "IDispatch".
So, using that API from any .NET languages and script languages is too tricky.
The reason why this library developed is to make it easier to use that Windows OS API from any .NET languages and any script languages.
License
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net35 is compatible. net40 was computed. net403 was computed. net45 was computed. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 3.5
- No dependencies.
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
v.1.0.2
- Fix: ScanAndClean(filePath) method always returns "VirusFound".