VTSharp 1.0.0

dotnet add package VTSharp --version 1.0.0
                    
NuGet\Install-Package VTSharp -Version 1.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="VTSharp" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="VTSharp" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="VTSharp" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add VTSharp --version 1.0.0
                    
#r "nuget: VTSharp, 1.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.
#:package VTSharp@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=VTSharp&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=VTSharp&version=1.0.0
                    
Install as a Cake Tool

VTSharp

VTSharp is a .NET library for retrieving file scan reports from VirusTotal.

It uses Playwright to access VirusTotal's web interface and extract antivirus detection results, allowing .NET applications to retrieve and process file scan reports without having to implement browser automation themselves.

Requirements

VTSharp requires Playwright to be installed and configured in the environment where the application is running.

Disclaimer

VTSharp is an independent, unofficial, open-source project. It is not affiliated with, associated with, authorized by, endorsed by, or sponsored by VirusTotal or Google.

VirusTotal is a trademark of Google LLC. VTSharp is not intended to represent or impersonate VirusTotal, Google, or any of their products or services.

VTSharp is simply a technical tool that uses browser automation to interact with the publicly accessible VirusTotal web interface. It does not provide, resell, or redistribute VirusTotal's services.

The author does not claim ownership of VirusTotal, its trademarks, its services, or any data provided by VirusTotal.

This project is provided solely as a technical integration tool. You are solely responsible for how you use it and for ensuring that your use complies with VirusTotal's terms of service, policies, and applicable laws.

The author makes no guarantees regarding the availability, accuracy, reliability, or continued compatibility of VTSharp with VirusTotal.

Features

  • Retrieve VirusTotal file reports using a SHA-256 hash.
  • Extract antivirus detection results.
  • Identify the number of positive detections and total scanning engines.
  • Classify files as Safe, Suspicious, or Dangerous.
  • Optional proxy support.
  • Configurable navigation and detection timeouts.
  • Dependency Injection support.
  • Async API.

Installation

Install the VTSharp NuGet package:

dotnet add package VTSharp

Dependency Injection

Register VTSharp in your application's dependency injection container:

var serviceProvider = new ServiceCollection()
    .AddVTSharp()
    .BuildServiceProvider();

You can configure VTSharp using VTSharpOptions:

var serviceProvider = new ServiceCollection()
    .AddVTSharp(options =>
    {
        options.ProxyServer = "http://127.0.0.1:8080";
        options.ProxyUsername = "username";
        options.ProxyPassword = "password";

        options.NavigationTimeout = TimeSpan.FromSeconds(30);
        options.DetectionTimeout = TimeSpan.FromSeconds(15);
    })
    .BuildServiceProvider();

All options are optional.

public class VTSharpOptions
{
    public string? ProxyServer { get; set; }

    public string? ProxyUsername { get; set; }

    public string? ProxyPassword { get; set; }

    public TimeSpan NavigationTimeout { get; set; }
        = TimeSpan.FromSeconds(30);

    public TimeSpan DetectionTimeout { get; set; }
        = TimeSpan.FromSeconds(15);
}

If no proxy is configured, VTSharp connects directly.

Usage

Resolve IVTClient from the dependency injection container:

var client = serviceProvider.GetRequiredService<IVTClient>();

Then, retrieve the report using the file's SHA-256 hash:

string sha256 = "2546dcffc5ad854d4ddc64fbf056871cd5a00f2471cb7a5bfd4ac23b6e9eedad";
 
var report = await client.GetFileReportAsync(sha256);

The Sha256 property is used to locate the file report on VirusTotal.

File Report

GetFileReportAsync returns a FileReportResult containing the analysis information:

public sealed class FileReportResult
{
    public string FileName { get; init; }

    public string Sha256 { get; init; }

    public string FileSize { get; init; }

    public int PositiveDetections { get; init; }

    public int TotalEngines { get; init; }

    public bool IsSuccessful { get; init; }

    public string? ErrorMessage { get; init; }

    public List<Detection> Detections { get; init; }

    public FileStatus Status { get; }
}

File Status

VTSharp calculates a simple status based on the proportion of positive detections:

  • Safe — less than 10% of engines detected the file.
  • Suspicious — between 10% and 40% of engines detected the file.
  • Dangerous — 40% or more of engines detected the file.

Error Handling

If the report cannot be retrieved, IsSuccessful will be false and ErrorMessage will contain the error information.

if (!report.IsSuccessful)
{
    Console.WriteLine($"Scan failed: {report.ErrorMessage}");
    return;
}
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 77 8/13/2026