--- id: pydivert version: "3.1.3" license: LGPL-3.0-or-later OR GPL-2.0-or-later license_treatment: copyleft maintenance: active --- # pydivert — Python binding to windivert driver License: copyleft · Maintenance: active · Downloads: 291.3K/mo ## What it is and what it does PyDivert wraps the WinDivert driver to give Python code direct access to the Windows network stack at the user-mode level. You can intercept packets matching a filter expression, inspect or modify their headers and payloads, drop them, or re-inject them. The package includes bundled WinDivert 2.2+ binaries so you don't have to install the driver separately. It supports both synchronous and asynchronous workflows via asyncio, modern Python pattern matching (PEP 634), and advanced WinDivert features like FLOW, SOCKET, and REFLECT layers. Common use cases include building firewalls, monitoring or modifying network traffic, redacting sensitive payloads, and analyzing TCP/IP behavior. Requires Windows 11 64-bit, Python 3.10+, and administrator privileges. Use it for: - Build a local firewall that blocks traffic from specific IP addresses or ports by dropping packets before they reach their destination. - Monitor and log HTTP/HTTPS traffic on a machine for debugging or security auditing purposes. - Redact or modify sensitive data (tokens, credentials) in network payloads before they leave the system. - Analyze TCP/IP behavior and test network stack interactions by capturing and inspecting real packets. - Implement packet-level rate limiting or traffic shaping by intercepting and selectively dropping or delaying packets. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. PyDivert is a Python binding for the WinDivert Windows driver that lets you capture, modify, drop, and re-inject network packets from user-mode code. Yes, if you are on Windows 11 64-bit and need low-level network packet control from Python. The package is actively maintained, has no runtime dependencies, includes bundled binaries for easy setup, and supports modern Python versions. The copyleft license (LGPL/GPL) is a hard blocker for proprietary closed-source applications unless you can relicense. No known security vulnerabilities. ## Install pip install pydivert uv add pydivert poetry add pydivert ## Installing pydivert Before you install: Installation is straightforward with no runtime dependencies and low friction. The package is actively maintained with a recent release and includes bundled WinDivert binaries, eliminating manual driver setup. However, it requires Windows 11 64-bit and administrator privileges to function. License in practice: PyDivert is dual-licensed under LGPL-3.0-or-later and GPL-2.0-or-later (copyleft). Any derivative work must comply with both licenses; proprietary applications using this package must either adopt a compatible copyleft license or obtain a separate commercial license. Quickstart: pip install pydivert import pydivert with pydivert.WinDivert("tcp.DstPort == 80") as w: for packet in w: print(f"Captured: {packet}") w.send(packet) Requires Windows 11 64-bit, Python 3.10+, and administrator privileges to run; WinDivert driver must be loaded by the OS. Verify before relying: - Whether Windows Server actually works despite being untested in the documentation. - Performance characteristics under high packet volume or complex filter rules. - Compatibility with Windows Defender or other security software that may interfere with driver access. ## Package facts - License: LGPL-3.0-or-later OR GPL-2.0-or-later (copyleft) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 291.3K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags network packet capture windows, packet interception modification, windivert python binding, firewall packet filtering, network traffic inspection, tcp ip packet manipulation, windows network driver, windows-only, network-interception, copyleft-license [View on SkillFed](https://skillfed.io/packages/pydivert) · [View on PyPI](https://pypi.org/project/pydivert/)