WindivertUtil 2.0.1

dotnet add package WindivertUtil --version 2.0.1
                    
NuGet\Install-Package WindivertUtil -Version 2.0.1
                    
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="WindivertUtil" Version="2.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WindivertUtil" Version="2.0.1" />
                    
Directory.Packages.props
<PackageReference Include="WindivertUtil" />
                    
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 WindivertUtil --version 2.0.1
                    
#r "nuget: WindivertUtil, 2.0.1"
                    
#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 WindivertUtil@2.0.1
                    
#: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=WindivertUtil&version=2.0.1
                    
Install as a Cake Addin
#tool nuget:?package=WindivertUtil&version=2.0.1
                    
Install as a Cake Tool

WindivertUtil

A lightweight Windows network packet interception library based on WinDivert. Capture and inject network traffic with a simple event-driven API.

Features

  • WinDivertInterceptor - Intercept packets destined for specific IP:Port
  • Configurable target IP and port
  • Event-driven asynchronous architecture
  • Zero external dependencies

Installation

dotnet add package WindivertUtil

Requirements

  • Administrator privileges (required to run)
  • WinDivert driver must be installed

Installing WinDivert Driver

Download and install WinDivert from: https://reqrypt.org/windivert.html

Alternatively, include WinDivert.dll and WinDivert64.sys files in your project output directory.

Quick Start

Basic Usage

API Reference

WinDivertInterceptor

Member Description
WinDivertInterceptor(ip, port) Constructor - specify target IP and port
StartAsync() Start packet interception
Stop() Stop packet interception
InjectPacketFromCloud(byte[]) Inject packet into local network stack
OnPacketIntercepted Event raised when packet is intercepted
OnLog Event raised for log messages
OnError Event raised on errors
PacketsIntercepted Count of intercepted packets
BytesTransmitted Total bytes transmitted

Native Dependencies

This library requires WinDivert native libraries:

  • WinDivert.dll - x86/x64 DLL
  • WinDivert64.sys - x64 driver file

Ensure these files are in your application's output directory, or install the WinDivert driver.

FAQ

Q: "Failed to open WinDivert handle" error?

A: Ensure:

  1. Run your application as Administrator
  2. WinDivert driver is installed

License

This library is licensed under the MIT License.

Note: WinDivert is licensed under GPLv3. If you distribute this library, you may need to comply with WinDivert's license terms.

Product Compatible and additional computed target framework versions.
.NET net6.0-windows7.0 is compatible.  net7.0-windows was computed.  net8.0-windows was computed.  net9.0-windows 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.
  • net6.0-windows7.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.

Version Downloads Last Updated
2.0.1 103 4/23/2026
2.0.0 103 4/23/2026
1.0.0 94 4/23/2026

v2.0.0 - Initial release
- WinDivertInterceptor: Intercept packets to specified IP:Port
- WinDivertNative: P/Invoke wrapper for WinDivert API
- TcpPayloadExtractor: TCP payload extraction utility
- Configurable IP and Port
- Event-driven asynchronous architecture