nClam 9.0.0

dotnet add package nClam --version 9.0.0                
NuGet\Install-Package nClam -Version 9.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="nClam" Version="9.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add nClam --version 9.0.0                
#r "nuget: nClam, 9.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install nClam as a Cake Addin
#addin nuget:?package=nClam&version=9.0.0

// Install nClam as a Cake Tool
#tool nuget:?package=nClam&version=9.0.0                

nClam Build status NuGet version

nClam is a tiny library which helps you scan files or directories using a ClamAV server. It contains a simple API which encapsulates the communication with the ClamAV server as well as the parsing of its results. The library is licensed under the Apache License 2.0.

Dependencies

ClamAV Server, also known as clamd. It is a free, open-source virus scanner. Win32 ports can be obtained here: http://oss.netfarm.it/clamav/

NuGet Package

Install-Package nClam

Directions

  1. Add the nuget package to your project.
  2. Create a nClam.ClamClient object, passing it the hostname (or IP address) and port of the ClamAV server.
  3. Scan!

Code Example

using System;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using nClam;

class Program
{
    static async Task Main(string[] args)
    {
        var clam = new ClamClient("localhost", 3310);
		// or var clam = new ClamClient(IPAddress.Parse("127.0.0.1"), 3310);
        var scanResult = await clam.ScanFileOnServerAsync("C:\\test.txt");  //any file you would like!

        switch (scanResult.Result)
        {
            case ClamScanResults.Clean:
                Console.WriteLine("The file is clean!");
                break;
            case ClamScanResults.VirusDetected:
                Console.WriteLine("Virus Found!");
                Console.WriteLine("Virus name: {0}", scanResult.InfectedFiles.First().VirusName);
                break;
            case ClamScanResults.Error:
                Console.WriteLine("Woah an error occured! Error: {0}", scanResult.RawResult);
                break;
        }
        
    }
}

ClamAV Setup for Windows

For directions on setting up ClamAV as a Windows Service, check out this blog post.

Test Application

For more information about how to use nClam, you can look at the nClam.ConsoleTest project's Program.cs.

Contributing

I accept PRs! We have had several contributors help maintain this library by fixing bugs, introducing async support, and moving to .NET Core. Thank you to all the contributors!

Product 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 is compatible. 
.NET Framework 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

  • .NETStandard 2.1

    • No dependencies.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on nClam:

Package Downloads
Serenity.Extensions

Package Description

CodeZero

CodeZero is a set of common implementations to help you implementing Clean Architecture, DDD, CQRS, Specification Patterns and another facilities for new modern web applications is an open-source project written in .NET Core.

Vault.AV.Clam

Vault Clam AntiVirus integration library.

Vivet.AspNetCore.RequestVirusScan

Middleware for scanning uplaoded files for virusses.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on nClam:

Repository Stars
v0l/void.cat
Free file hosting website
Version Downloads Last updated
9.0.0 911,293 2/13/2024
8.0.0 8,996 2/13/2024
7.0.0 3,105,452 2/18/2022
6.0.1 1,191,079 7/23/2021
6.0.0 23,895 7/10/2021
5.0.1 547,341 12/10/2020
5.0.0 801 12/9/2020
4.0.1 1,387,352 3/29/2018
4.0.0 173,507 8/18/2017
3.0.0 52,221 11/11/2016
2.0.6 261,072 12/22/2014
2.0.0 64,892 5/8/2013
1.0.0 8,060 5/12/2011