|
| 1 | +WinDivert 1.1: Windows Packet Divert |
| 2 | +==================================== |
| 3 | + |
| 4 | +1. Introduction |
| 5 | +--------------- |
| 6 | + |
| 7 | +Windows Packet Divert (WinDivert) is a user-mode packet capture-and-divert |
| 8 | +package for Windows Vista, Windows 2008, Windows 7, and Windows 8. |
| 9 | + |
| 10 | +With WinDivert developers can write user-mode programs that capture and |
| 11 | +modify or drop network packets sent to/from the Windows network stack. |
| 12 | +In summary, WinDivert can |
| 13 | + - capture network packets |
| 14 | + - filter/drop network packets |
| 15 | + - sniff network packets |
| 16 | + - (re)inject network packets |
| 17 | + - modify network packets |
| 18 | + |
| 19 | +WinDivert can be used to implement user-mode packet filters, packet sniffers, |
| 20 | +firewalls, NAT, VPNs, tunneling applications, etc., etc.. If you |
| 21 | +need to intercept and modify packets, then WinDivert is for you. |
| 22 | + |
| 23 | +The features of WinDivert include: |
| 24 | + - packet interception, sniffing, or dropping modes |
| 25 | + - support for loopback (localhost) traffic |
| 26 | + - full IPv6 support |
| 27 | + - network layer |
| 28 | + - simple and powerful API |
| 29 | + - high-level filtering language |
| 30 | + - filter priorities |
| 31 | + - freely available under the terms of the GNU Lesser General Public |
| 32 | + License (LGPL) |
| 33 | + |
| 34 | +For more information about WinDivert, see doc/divert.html |
| 35 | + |
| 36 | +2. Similar Packages |
| 37 | +------------------- |
| 38 | + |
| 39 | +WinDivert is similar to divert sockets in FreeBSD/MacOS, NETLINK sockets in |
| 40 | +Linux, and some commercial packet capturing packages such as WinPkFilter for |
| 41 | +Windows. The design of WinDivert is largely influenced by FreeBSD's divert |
| 42 | +sockets. |
| 43 | + |
| 44 | +WinDivert in packet-sniffing mode is similar to Winpcap. Unlike Winpcap, |
| 45 | +WinDivert fully supports capturing loopback traffic. Furthermore, WinDivert |
| 46 | +supports packet interception, which is not supported in Winpcap. |
| 47 | + |
| 48 | +3. Architecture |
| 49 | +--------------- |
| 50 | + |
| 51 | +The basic architecture of WinDivert is as follows: |
| 52 | + |
| 53 | + +-----------------+ |
| 54 | + | | |
| 55 | + +------->| PROGRAM |--------+ |
| 56 | + | | (WinDivert.dll) | | |
| 57 | + | +-----------------+ | |
| 58 | + | | (3) re-injected |
| 59 | + | (2a) matching packet | packet |
| 60 | + | | |
| 61 | + | | |
| 62 | + [user mode] | | |
| 63 | + ....................|...................................|................... |
| 64 | + [kernel mode] | | |
| 65 | + | | |
| 66 | + | | |
| 67 | + +---------------+ +-----------------> |
| 68 | + (1) packet | | (2b) non-matching packet |
| 69 | + ------------>| WinDivert.sys |--------------------------------------------> |
| 70 | + | | |
| 71 | + +---------------+ |
| 72 | + |
| 73 | +The WinDivert.sys driver is inserted below the Windows network stack. The |
| 74 | +following then happens |
| 75 | + |
| 76 | +(1) a new packet enters the network stack and is intercepted by WinDivert.sys |
| 77 | +(2a) if the packet matches a PROGRAM-defined filter, it is diverted. The |
| 78 | + PROGRAM reads the packet with a call to the WinDivertRecv() function. |
| 79 | +(2b) if the packet does not match the filter, the packet is permitted to |
| 80 | + continue as normal. |
| 81 | +(3) PROGRAM either drops, modifies, or re-injects the packet. If the |
| 82 | + (modified) packet is re-injected, via a call to WinDivertSend(), it is |
| 83 | + inserted back into the Windows network stack. |
| 84 | + |
| 85 | +4. Building |
| 86 | +----------- |
| 87 | + |
| 88 | +(1) In a WinDDK build environment, run the command: |
| 89 | + |
| 90 | + wddk-build.bat |
| 91 | + |
| 92 | +(2) [OPTIONAL Visual Studio 2012 support] In a VS2012 command prompt, run the |
| 93 | + command: |
| 94 | + |
| 95 | + msvc-build.bat |
| 96 | + |
| 97 | +(3) [OPTIONAL MinGW support] In Linux with MinGW a cross-compiler, run the |
| 98 | + command: |
| 99 | + |
| 100 | + sh mingw-build.sh |
| 101 | + |
| 102 | +For more detailed build instructions, see doc\windivert.html |
| 103 | + |
| 104 | +5. License |
| 105 | +---------- |
| 106 | + |
| 107 | +This package is distributed under the GNU Lesser General Public License |
| 108 | +(LGPL) Version 3. See LICENSE for more information. |
| 109 | + |
| 110 | +This program is free software: you can redistribute it and/or modify |
| 111 | +it under the terms of the GNU Lesser General Public License as published by |
| 112 | +the Free Software Foundation, either version 3 of the License, or |
| 113 | +(at your option) any later version. |
| 114 | + |
| 115 | +This program is distributed in the hope that it will be useful, |
| 116 | +but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 117 | +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 118 | +GNU Lesser General Public License for more details. |
| 119 | + |
| 120 | +You should have received a copy of the GNU Lesser General Public License |
| 121 | +along with this program. If not, see <http://www.gnu.org/licenses/> |
| 122 | + |
| 123 | +6. About |
| 124 | +-------- |
| 125 | + |
| 126 | +WinDivert was written by basil. |
| 127 | + |
| 128 | +For further information, or bug reports, please contact |
| 129 | + |
| 130 | + basil AT reqrypt DOT org |
| 131 | + |
| 132 | +The homepage for WinDivert is |
| 133 | + |
| 134 | + http://reqrypt.org/windivert.html |
| 135 | + |
| 136 | +The source code for WinDivert is hosted by GitHub at |
| 137 | + |
| 138 | + https://github.com/basil00/Divert |
| 139 | + |
0 commit comments