Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 97101072db | |||
| 8bda0aff7b | |||
| 34b565de65 | |||
| 90396ffa2b | |||
| 8cdddce6ac | |||
| c26ec39465 | |||
| 227a6b1e78 | |||
| 134dd37bd0 | |||
| 97056af256 | |||
| db674a6696 | |||
| 32af280add | |||
| 091ffb3d49 | |||
| aff111e44d | |||
| 160d983960 | |||
| 69b4620277 | |||
| bcba321048 | |||
| 0c773bc08f | |||
| eba2e59e3b | |||
| 951560d403 | |||
| 7dc1c5d54a | |||
| a1173fe08f | |||
| a240329323 | |||
| 317e6f1099 | |||
| 6501bec357 | |||
| 194d9afa1e | |||
| 69e4edade7 | |||
| 6eb82d08e0 | |||
| 02541ce1da | |||
| db7f80d26d | |||
| cedb929873 | |||
| 5d62e2a938 | |||
| 8c4bbf31c6 |
@@ -291,3 +291,24 @@ WinDivert 2.0.0-rc
|
||||
values correspond to higher priorities.
|
||||
- The last two arguments for WinDivertRecv() and WinDivertSend() have been
|
||||
swapped.
|
||||
WinDivert 2.0.1-rc
|
||||
- Fix WFP callout install optimization bug.
|
||||
- Fix WinDivertHelperNtohIpv6Address/WinDivertHelperHtonIpv6Address bug.
|
||||
- Rename the following functions for consistency:
|
||||
* WinDivertHelperNtohIpv6Address -> WinDivertHelperNtohIPv6Address
|
||||
* WinDivertHelperHtonIpv6Address -> WinDivertHelperHtonIPv6Address
|
||||
WinDivert 2.1.0
|
||||
- WinDivertOpen() now supports a new flag:
|
||||
* WINDIVERT_FLAG_FRAGMENTS: If set, the handle will capture inbound IP
|
||||
fragments, but not inbound reassembled IP packets. Otherwise, if not
|
||||
set (the default), the handle will capture inbound reassembled IP
|
||||
packets, but not inbound IP fragments. This flag only affects
|
||||
inbound packets at the NETWORK layer.
|
||||
- Filter fields inbound/outbound are now supported at the SOCKET layer.
|
||||
- Fix BSOD caused by packets with missing or incomplete transport
|
||||
headers (introduced in 2.0.0).
|
||||
- Fix missing Flow.EndpointId and Flow.ParentEndpointId for IPv6 flows.
|
||||
WinDivert 2.2.0
|
||||
- Implement new packet parser that correctly handles IP fragments.
|
||||
- Add a new "fragment" filter field that matches IP fragments.
|
||||
- (Un)Loading the WinDivert driver will cause a system event to be logged.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
WinDivert 2.0: Windows Packet Divert
|
||||
WinDivert 2.2: Windows Packet Divert
|
||||
====================================
|
||||
|
||||
1. Introduction
|
||||
|
||||
+187
-34
@@ -43,7 +43,9 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define WINDIVERTEXPORT
|
||||
#ifndef WINDIVERTEXPORT
|
||||
#define WINDIVERTEXPORT extern
|
||||
#endif
|
||||
#include "windivert.h"
|
||||
#include "windivert_device.h"
|
||||
|
||||
@@ -56,6 +58,7 @@
|
||||
#define ERROR_DRIVER_FAILED_PRIOR_UNLOAD ((DWORD)654)
|
||||
#endif
|
||||
|
||||
static BOOLEAN WinDivertIsDigit(char c);
|
||||
static BOOLEAN WinDivertIsXDigit(char c);
|
||||
static BOOLEAN WinDivertIsSpace(char c);
|
||||
static BOOLEAN WinDivertIsAlNum(char c);
|
||||
@@ -69,6 +72,7 @@ static BOOLEAN WinDivertAToI(const char *str, char **endptr, UINT32 *intptr,
|
||||
UINT size);
|
||||
static BOOLEAN WinDivertAToX(const char *str, char **endptr, UINT32 *intptr,
|
||||
UINT size, BOOL prefix);
|
||||
static UINT32 WinDivertDivTen128(UINT32 *a);
|
||||
|
||||
/*
|
||||
* Misc.
|
||||
@@ -76,10 +80,54 @@ static BOOLEAN WinDivertAToX(const char *str, char **endptr, UINT32 *intptr,
|
||||
#ifndef UINT8_MAX
|
||||
#define UINT8_MAX 0xFF
|
||||
#endif
|
||||
#ifndef UINT16_MAX
|
||||
#define UINT16_MAX 0xFFFF
|
||||
#endif
|
||||
#ifndef UINT32_MAX
|
||||
#define UINT32_MAX 0xFFFFFFFF
|
||||
#endif
|
||||
|
||||
#define IPPROTO_MH 135
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
#pragma intrinsic(memcpy)
|
||||
#pragma function(memcpy)
|
||||
void *memcpy(void *dst, const void *src, size_t n)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < n; i++)
|
||||
((UINT8 *)dst)[i] = ((const UINT8 *)src)[i];
|
||||
return dst;
|
||||
}
|
||||
|
||||
#pragma intrinsic(memset)
|
||||
#pragma function(memset)
|
||||
void *memset(void *dst, int c, size_t n)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < n; i++)
|
||||
((UINT8 *)dst)[i] = (UINT8)c;
|
||||
return dst;
|
||||
}
|
||||
|
||||
#define WINDIVERT_INLINE __forceinline
|
||||
|
||||
#else /* _MSC_VER */
|
||||
|
||||
#define WINDIVERT_INLINE __attribute__((__always_inline__)) inline
|
||||
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
/*
|
||||
* Filter interpreter config.
|
||||
*/
|
||||
static BOOL WinDivertGetData(const VOID *packet, UINT packet_len, INT min,
|
||||
INT max, INT idx, PVOID data, UINT size);
|
||||
#define WINDIVERT_GET_DATA(packet, packet_len, min, max, index, data, size) \
|
||||
WinDivertGetData((packet), (packet_len), (min), (max), (index), (data), \
|
||||
(size))
|
||||
|
||||
/*
|
||||
* Prototypes.
|
||||
*/
|
||||
@@ -106,8 +154,7 @@ static HMODULE module = NULL;
|
||||
/*
|
||||
* Dll Entry
|
||||
*/
|
||||
extern BOOL APIENTRY WinDivertDllEntry(HANDLE module0, DWORD reason,
|
||||
LPVOID reserved)
|
||||
BOOL APIENTRY WinDivertDllEntry(HANDLE module0, DWORD reason, LPVOID reserved)
|
||||
{
|
||||
HANDLE event;
|
||||
switch (reason)
|
||||
@@ -216,6 +263,33 @@ static BOOLEAN WinDivertGetDriverFileName(LPWSTR sys_str)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Register event log. It is not an error if this function fails.
|
||||
*/
|
||||
static void WinDivertRegisterEventSource(const wchar_t *windivert_sys)
|
||||
{
|
||||
HKEY key;
|
||||
size_t len;
|
||||
DWORD types = 7;
|
||||
|
||||
if (!WinDivertStrLen(windivert_sys, MAX_PATH, &len))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (RegCreateKeyExA(HKEY_LOCAL_MACHINE,
|
||||
"System\\CurrentControlSet\\Services\\EventLog\\System\\WinDivert",
|
||||
0, NULL, REG_OPTION_VOLATILE, KEY_SET_VALUE, NULL, &key, NULL)
|
||||
!= ERROR_SUCCESS)
|
||||
{
|
||||
return;
|
||||
}
|
||||
RegSetValueExW(key, L"EventMessageFile", 0, REG_SZ, (LPBYTE)windivert_sys,
|
||||
(len + 1) * sizeof(wchar_t));
|
||||
RegSetValueExA(key, "TypesSupported", 0, REG_DWORD, (LPBYTE)&types,
|
||||
sizeof(types));
|
||||
RegCloseKey(key);
|
||||
}
|
||||
|
||||
/*
|
||||
* Install the WinDivert driver.
|
||||
*/
|
||||
@@ -277,6 +351,9 @@ static BOOLEAN WinDivertDriverInstall(VOID)
|
||||
goto WinDivertDriverInstallExit;
|
||||
}
|
||||
|
||||
// Register event logging:
|
||||
WinDivertRegisterEventSource(windivert_sys);
|
||||
|
||||
WinDivertDriverInstallExit:
|
||||
|
||||
success = (service != NULL);
|
||||
@@ -309,7 +386,7 @@ WinDivertDriverInstallExit:
|
||||
ReleaseMutex(mutex);
|
||||
CloseHandle(mutex);
|
||||
SetLastError(err);
|
||||
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
@@ -374,14 +451,14 @@ static BOOL WinDivertIoControl(HANDLE handle, DWORD code,
|
||||
/*
|
||||
* Open a WinDivert handle.
|
||||
*/
|
||||
extern HANDLE WinDivertOpen(const char *filter, WINDIVERT_LAYER layer,
|
||||
INT16 priority, UINT64 flags)
|
||||
HANDLE WinDivertOpen(const char *filter, WINDIVERT_LAYER layer, INT16 priority,
|
||||
UINT64 flags)
|
||||
{
|
||||
WINDIVERT_FILTER object[WINDIVERT_FILTER_MAXLEN];
|
||||
WINDIVERT_FILTER *object;
|
||||
UINT obj_len;
|
||||
ERROR comp_err;
|
||||
DWORD err;
|
||||
HANDLE handle;
|
||||
HANDLE handle, pool;
|
||||
UINT64 filter_flags;
|
||||
WINDIVERT_IOCTL ioctl;
|
||||
WINDIVERT_VERSION version;
|
||||
@@ -393,7 +470,7 @@ extern HANDLE WinDivertOpen(const char *filter, WINDIVERT_LAYER layer,
|
||||
offsetof(WINDIVERT_DATA_SOCKET, Protocol) != 56 ||
|
||||
offsetof(WINDIVERT_DATA_REFLECT, Priority) != 24 ||
|
||||
sizeof(WINDIVERT_FILTER) != 24 ||
|
||||
offsetof(WINDIVERT_ADDRESS, Reserved2) != 16)
|
||||
offsetof(WINDIVERT_ADDRESS, Reserved3) != 16)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return INVALID_HANDLE_VALUE;
|
||||
@@ -426,9 +503,25 @@ extern HANDLE WinDivertOpen(const char *filter, WINDIVERT_LAYER layer,
|
||||
}
|
||||
|
||||
// Compile & analyze the filter:
|
||||
comp_err = WinDivertCompileFilter(filter, layer, object, &obj_len);
|
||||
pool = HeapCreate(HEAP_NO_SERIALIZE, WINDIVERT_MIN_POOL_SIZE,
|
||||
WINDIVERT_MAX_POOL_SIZE);
|
||||
if (pool == NULL)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
object = HeapAlloc(pool, 0,
|
||||
WINDIVERT_FILTER_MAXLEN * sizeof(WINDIVERT_FILTER));
|
||||
if (object == NULL)
|
||||
{
|
||||
err = GetLastError();
|
||||
HeapDestroy(pool);
|
||||
SetLastError(err);
|
||||
return FALSE;
|
||||
}
|
||||
comp_err = WinDivertCompileFilter(filter, pool, layer, object, &obj_len);
|
||||
if (IS_ERROR(comp_err))
|
||||
{
|
||||
HeapDestroy(pool);
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
@@ -443,31 +536,36 @@ extern HANDLE WinDivertOpen(const char *filter, WINDIVERT_LAYER layer,
|
||||
err = GetLastError();
|
||||
if (err != ERROR_FILE_NOT_FOUND && err != ERROR_PATH_NOT_FOUND)
|
||||
{
|
||||
HeapDestroy(pool);
|
||||
SetLastError(err);
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
// Open failed because the device isn't installed; install it now.
|
||||
if ((flags & WINDIVERT_FLAG_NO_INSTALL) != 0)
|
||||
{
|
||||
HeapDestroy(pool);
|
||||
SetLastError(ERROR_SERVICE_DOES_NOT_EXIST);
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
SetLastError(0);
|
||||
if (!WinDivertDriverInstall())
|
||||
{
|
||||
if (GetLastError() == 0)
|
||||
{
|
||||
SetLastError(ERROR_OPEN_FAILED);
|
||||
}
|
||||
err = GetLastError();
|
||||
err = (err == 0? ERROR_OPEN_FAILED: err);
|
||||
HeapDestroy(pool);
|
||||
SetLastError(err);
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
handle = CreateFile(L"\\\\.\\" WINDIVERT_DEVICE_NAME,
|
||||
GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING,
|
||||
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED,
|
||||
INVALID_HANDLE_VALUE);
|
||||
|
||||
if (handle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
err = GetLastError();
|
||||
HeapDestroy(pool);
|
||||
SetLastError(err);
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
}
|
||||
@@ -485,13 +583,17 @@ extern HANDLE WinDivertOpen(const char *filter, WINDIVERT_LAYER layer,
|
||||
if (!WinDivertIoControl(handle, IOCTL_WINDIVERT_INITIALIZE, &ioctl,
|
||||
&version, sizeof(version), NULL))
|
||||
{
|
||||
err = GetLastError();
|
||||
CloseHandle(handle);
|
||||
HeapDestroy(pool);
|
||||
SetLastError(err);
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
if (version.magic != WINDIVERT_MAGIC_SYS ||
|
||||
version.major < WINDIVERT_VERSION_MAJOR_MIN)
|
||||
{
|
||||
CloseHandle(handle);
|
||||
HeapDestroy(pool);
|
||||
SetLastError(ERROR_DRIVER_FAILED_PRIOR_UNLOAD);
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
@@ -502,9 +604,13 @@ extern HANDLE WinDivertOpen(const char *filter, WINDIVERT_LAYER layer,
|
||||
if (!WinDivertIoControl(handle, IOCTL_WINDIVERT_STARTUP, &ioctl,
|
||||
object, obj_len * sizeof(WINDIVERT_FILTER), NULL))
|
||||
{
|
||||
err = GetLastError();
|
||||
CloseHandle(handle);
|
||||
HeapDestroy(pool);
|
||||
SetLastError(err);
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
HeapDestroy(pool);
|
||||
|
||||
// Success!
|
||||
return handle;
|
||||
@@ -513,13 +619,13 @@ extern HANDLE WinDivertOpen(const char *filter, WINDIVERT_LAYER layer,
|
||||
/*
|
||||
* Receive a WinDivert packet.
|
||||
*/
|
||||
extern BOOL WinDivertRecv(HANDLE handle, PVOID pPacket, UINT packetLen,
|
||||
UINT *readLen, PWINDIVERT_ADDRESS addr)
|
||||
BOOL WinDivertRecv(HANDLE handle, PVOID pPacket, UINT packetLen, UINT *readLen,
|
||||
PWINDIVERT_ADDRESS addr)
|
||||
{
|
||||
WINDIVERT_IOCTL ioctl;
|
||||
memset(&ioctl, 0, sizeof(ioctl));
|
||||
ioctl.recv.addr = (UINT64)addr;
|
||||
ioctl.recv.addr_len_ptr = (UINT64)NULL;
|
||||
ioctl.recv.addr = (UINT64)(ULONG_PTR)addr;
|
||||
ioctl.recv.addr_len_ptr = (UINT64)(ULONG_PTR)NULL;
|
||||
return WinDivertIoControl(handle, IOCTL_WINDIVERT_RECV, &ioctl,
|
||||
pPacket, packetLen, readLen);
|
||||
}
|
||||
@@ -527,14 +633,14 @@ extern BOOL WinDivertRecv(HANDLE handle, PVOID pPacket, UINT packetLen,
|
||||
/*
|
||||
* Receive a WinDivert packet.
|
||||
*/
|
||||
extern BOOL WinDivertRecvEx(HANDLE handle, PVOID pPacket, UINT packetLen,
|
||||
BOOL WinDivertRecvEx(HANDLE handle, PVOID pPacket, UINT packetLen,
|
||||
UINT *readLen, UINT64 flags, PWINDIVERT_ADDRESS addr, UINT *pAddrLen,
|
||||
LPOVERLAPPED overlapped)
|
||||
{
|
||||
WINDIVERT_IOCTL ioctl;
|
||||
memset(&ioctl, 0, sizeof(ioctl));
|
||||
ioctl.recv.addr = (UINT64)addr;
|
||||
ioctl.recv.addr_len_ptr = (UINT64)pAddrLen;
|
||||
ioctl.recv.addr = (UINT64)(ULONG_PTR)addr;
|
||||
ioctl.recv.addr_len_ptr = (UINT64)(ULONG_PTR)pAddrLen;
|
||||
if (flags != 0)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
@@ -555,12 +661,12 @@ extern BOOL WinDivertRecvEx(HANDLE handle, PVOID pPacket, UINT packetLen,
|
||||
/*
|
||||
* Send a WinDivert packet.
|
||||
*/
|
||||
extern BOOL WinDivertSend(HANDLE handle, const VOID *pPacket, UINT packetLen,
|
||||
BOOL WinDivertSend(HANDLE handle, const VOID *pPacket, UINT packetLen,
|
||||
UINT *writeLen, const WINDIVERT_ADDRESS *addr)
|
||||
{
|
||||
WINDIVERT_IOCTL ioctl;
|
||||
memset(&ioctl, 0, sizeof(ioctl));
|
||||
ioctl.send.addr = (UINT64)addr;
|
||||
ioctl.send.addr = (UINT64)(ULONG_PTR)addr;
|
||||
ioctl.send.addr_len = sizeof(WINDIVERT_ADDRESS);
|
||||
return WinDivertIoControl(handle, IOCTL_WINDIVERT_SEND, &ioctl,
|
||||
(PVOID)pPacket, packetLen, writeLen);
|
||||
@@ -569,13 +675,13 @@ extern BOOL WinDivertSend(HANDLE handle, const VOID *pPacket, UINT packetLen,
|
||||
/*
|
||||
* Send a WinDivert packet.
|
||||
*/
|
||||
extern BOOL WinDivertSendEx(HANDLE handle, const VOID *pPacket, UINT packetLen,
|
||||
BOOL WinDivertSendEx(HANDLE handle, const VOID *pPacket, UINT packetLen,
|
||||
UINT *writeLen, UINT64 flags, const WINDIVERT_ADDRESS *addr, UINT addrLen,
|
||||
LPOVERLAPPED overlapped)
|
||||
{
|
||||
WINDIVERT_IOCTL ioctl;
|
||||
memset(&ioctl, 0, sizeof(ioctl));
|
||||
ioctl.send.addr = (UINT64)addr;
|
||||
ioctl.send.addr = (UINT64)(ULONG_PTR)addr;
|
||||
ioctl.send.addr_len = addrLen;
|
||||
if (flags != 0)
|
||||
{
|
||||
@@ -597,7 +703,7 @@ extern BOOL WinDivertSendEx(HANDLE handle, const VOID *pPacket, UINT packetLen,
|
||||
/*
|
||||
* Shutdown a WinDivert handle.
|
||||
*/
|
||||
extern BOOL WinDivertShutdown(HANDLE handle, WINDIVERT_SHUTDOWN how)
|
||||
BOOL WinDivertShutdown(HANDLE handle, WINDIVERT_SHUTDOWN how)
|
||||
{
|
||||
WINDIVERT_IOCTL ioctl;
|
||||
memset(&ioctl, 0, sizeof(ioctl));
|
||||
@@ -609,7 +715,7 @@ extern BOOL WinDivertShutdown(HANDLE handle, WINDIVERT_SHUTDOWN how)
|
||||
/*
|
||||
* Close a WinDivert handle.
|
||||
*/
|
||||
extern BOOL WinDivertClose(HANDLE handle)
|
||||
BOOL WinDivertClose(HANDLE handle)
|
||||
{
|
||||
return CloseHandle(handle);
|
||||
}
|
||||
@@ -617,8 +723,7 @@ extern BOOL WinDivertClose(HANDLE handle)
|
||||
/*
|
||||
* Set a WinDivert parameter.
|
||||
*/
|
||||
extern BOOL WinDivertSetParam(HANDLE handle, WINDIVERT_PARAM param,
|
||||
UINT64 value)
|
||||
BOOL WinDivertSetParam(HANDLE handle, WINDIVERT_PARAM param, UINT64 value)
|
||||
{
|
||||
WINDIVERT_IOCTL ioctl;
|
||||
memset(&ioctl, 0, sizeof(ioctl));
|
||||
@@ -631,8 +736,7 @@ extern BOOL WinDivertSetParam(HANDLE handle, WINDIVERT_PARAM param,
|
||||
/*
|
||||
* Get a WinDivert parameter.
|
||||
*/
|
||||
extern BOOL WinDivertGetParam(HANDLE handle, WINDIVERT_PARAM param,
|
||||
UINT64 *pValue)
|
||||
BOOL WinDivertGetParam(HANDLE handle, WINDIVERT_PARAM param, UINT64 *pValue)
|
||||
{
|
||||
WINDIVERT_IOCTL ioctl;
|
||||
memset(&ioctl, 0, sizeof(ioctl));
|
||||
@@ -645,6 +749,11 @@ extern BOOL WinDivertGetParam(HANDLE handle, WINDIVERT_PARAM param,
|
||||
/* REPLACEMENTS */
|
||||
/*****************************************************************************/
|
||||
|
||||
static BOOLEAN WinDivertIsDigit(char c)
|
||||
{
|
||||
return (c >= '0' && c <= '9');
|
||||
}
|
||||
|
||||
static BOOLEAN WinDivertIsXDigit(char c)
|
||||
{
|
||||
return (c >= '0' && c <= '9') ||
|
||||
@@ -756,7 +865,7 @@ static BOOLEAN WinDivertAToI(const char *str, char **endptr, UINT32 *intptr,
|
||||
size_t i = 0;
|
||||
UINT32 n[4] = {0};
|
||||
BOOLEAN result = TRUE;
|
||||
for (; str[i] && isdigit(str[i]); i++)
|
||||
for (; str[i] && WinDivertIsDigit(str[i]); i++)
|
||||
{
|
||||
if (!WinDivertMul128(n, 10) || !WinDivertAdd128(n, str[i] - '0'))
|
||||
{
|
||||
@@ -801,7 +910,7 @@ static BOOLEAN WinDivertAToX(const char *str, char **endptr, UINT32 *intptr,
|
||||
}
|
||||
for (; str[i] && WinDivertIsXDigit(str[i]); i++)
|
||||
{
|
||||
if (isdigit(str[i]))
|
||||
if (WinDivertIsDigit(str[i]))
|
||||
{
|
||||
dig = (UINT32)(str[i] - '0');
|
||||
}
|
||||
@@ -833,3 +942,47 @@ static BOOLEAN WinDivertAToX(const char *str, char **endptr, UINT32 *intptr,
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Divide by 10 and return the remainder.
|
||||
*/
|
||||
#define WINDIVERT_BIG_MUL_ROUND(a, c, r, i) \
|
||||
do { \
|
||||
UINT64 t = WINDIVERT_MUL64((UINT64)(a), (UINT64)(c)); \
|
||||
UINT k; \
|
||||
for (k = (i); k < 9 && t != 0; k++) \
|
||||
{ \
|
||||
UINT64 s = (UINT64)(r)[k] + (t & 0xFFFFFFFF); \
|
||||
(r)[k] = (UINT32)s; \
|
||||
t = (t >> 32) + (s >> 32); \
|
||||
} \
|
||||
} while (FALSE)
|
||||
static UINT32 WinDivertDivTen128(UINT32 *a)
|
||||
{
|
||||
const UINT32 c[5] =
|
||||
{
|
||||
0x9999999A, 0x99999999, 0x99999999, 0x99999999, 0x19999999
|
||||
};
|
||||
UINT32 r[9] = {0}, m[6] = {0};
|
||||
UINT i, j;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
for (j = 0; j < 5; j++)
|
||||
{
|
||||
WINDIVERT_BIG_MUL_ROUND(a[i], c[j], r, i+j);
|
||||
}
|
||||
}
|
||||
|
||||
a[0] = r[5];
|
||||
a[1] = r[6];
|
||||
a[2] = r[7];
|
||||
a[3] = r[8];
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
WINDIVERT_BIG_MUL_ROUND(r[i], 10, m, i);
|
||||
}
|
||||
|
||||
return m[5];
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -1,6 +1,5 @@
|
||||
LIBRARY WinDivert
|
||||
EXPORTS
|
||||
WinDivertDllEntry
|
||||
WinDivertOpen
|
||||
WinDivertRecv
|
||||
WinDivertRecvEx
|
||||
@@ -27,5 +26,7 @@ EXPORTS
|
||||
WinDivertHelperHtonl
|
||||
WinDivertHelperNtohll
|
||||
WinDivertHelperHtonll
|
||||
WinDivertHelperNtohIPv6Address
|
||||
WinDivertHelperHtonIPv6Address
|
||||
WinDivertHelperNtohIpv6Address
|
||||
WinDivertHelperHtonIpv6Address
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
|
||||
windivert.vcxproj
|
||||
(C) 2019, all rights reserved,
|
||||
|
||||
This file is part of WinDivert.
|
||||
|
||||
WinDivert is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU Lesser General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
WinDivert is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 2 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc., 51
|
||||
Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
-->
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="windivert.c">
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<AdditionalIncludeDirectories>..\include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<RootNamespace>WinDivert</RootNamespace>
|
||||
<ProjectName>WinDivert</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<WppEnabled>false</WppEnabled>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WIN32;NDEBUG;_WINDOWS;_USRDLL;DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WIN32;NDEBUG;_WINDOWS;_USRDLL;DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EntryPointSymbol>WinDivertDllEntry</EntryPointSymbol>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
|
||||
<ModuleDefinitionFile>windivert.def</ModuleDefinitionFile>
|
||||
<ImportLibrary>WinDivert.lib</ImportLibrary>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
</Project>
|
||||
+29
-27
@@ -68,7 +68,7 @@
|
||||
* only ever a single round. As such, the algorithm has been specialized.
|
||||
*/
|
||||
|
||||
#define WINDIVERT_ROTL(x, r) (((x) << (r)) | ((x) >> (64 - (r))))
|
||||
#define WINDIVERT_ROTL64(x, r) (((x) << (r)) | ((x) >> (64 - (r))))
|
||||
|
||||
static const UINT64 WINDIVERT_PRIME64_1 = 11400714785074694791ull;
|
||||
static const UINT64 WINDIVERT_PRIME64_2 = 14029467366897019727ull;
|
||||
@@ -77,9 +77,9 @@ static const UINT64 WINDIVERT_PRIME64_4 = 9650029242287828579ull;
|
||||
|
||||
static UINT64 WinDivertXXH64Round(UINT64 acc, UINT64 input)
|
||||
{
|
||||
acc += input * WINDIVERT_PRIME64_2;
|
||||
acc = WINDIVERT_ROTL(acc, 31);
|
||||
acc *= WINDIVERT_PRIME64_1;
|
||||
acc += WINDIVERT_MUL64(input, WINDIVERT_PRIME64_2);
|
||||
acc = WINDIVERT_ROTL64(acc, 31);
|
||||
acc = WINDIVERT_MUL64(acc, WINDIVERT_PRIME64_1);
|
||||
return acc;
|
||||
}
|
||||
|
||||
@@ -87,16 +87,16 @@ static UINT64 WinDivertXXH64MergeRound(UINT64 acc, UINT64 val)
|
||||
{
|
||||
val = WinDivertXXH64Round(0, val);
|
||||
acc ^= val;
|
||||
acc = acc * WINDIVERT_PRIME64_1 + WINDIVERT_PRIME64_4;
|
||||
acc = WINDIVERT_MUL64(acc, WINDIVERT_PRIME64_1) + WINDIVERT_PRIME64_4;
|
||||
return acc;
|
||||
}
|
||||
|
||||
static UINT64 WinDivertXXH64Avalanche(UINT64 h64)
|
||||
{
|
||||
h64 ^= h64 >> 33;
|
||||
h64 *= WINDIVERT_PRIME64_2;
|
||||
h64 = WINDIVERT_MUL64(h64, WINDIVERT_PRIME64_2);
|
||||
h64 ^= h64 >> 29;
|
||||
h64 *= WINDIVERT_PRIME64_3;
|
||||
h64 = WINDIVERT_MUL64(h64, WINDIVERT_PRIME64_3);
|
||||
h64 ^= h64 >> 32;
|
||||
return h64;
|
||||
}
|
||||
@@ -104,35 +104,37 @@ static UINT64 WinDivertXXH64Avalanche(UINT64 h64)
|
||||
/*
|
||||
* WinDivert packet hash function.
|
||||
*/
|
||||
static UINT64 WinDivertHashPacket(UINT64 seed, PWINDIVERT_IPHDR ip_header,
|
||||
PWINDIVERT_IPV6HDR ipv6_header, PWINDIVERT_ICMPHDR icmp_header,
|
||||
PWINDIVERT_ICMPV6HDR icmpv6_header, PWINDIVERT_TCPHDR tcp_header,
|
||||
PWINDIVERT_UDPHDR udp_header)
|
||||
static UINT64 WinDivertHashPacket(UINT64 seed,
|
||||
const WINDIVERT_IPHDR *ip_header, const WINDIVERT_IPV6HDR *ipv6_header,
|
||||
const WINDIVERT_ICMPHDR *icmp_header,
|
||||
const WINDIVERT_ICMPV6HDR *icmpv6_header,
|
||||
const WINDIVERT_TCPHDR *tcp_header, const WINDIVERT_UDPHDR *udp_header)
|
||||
{
|
||||
UINT64 h64, v1, v2, v3, v4, v[4], *data64;
|
||||
UINT32 *data32;
|
||||
UINT64 h64, v1, v2, v3, v4, v[4];
|
||||
const UINT64 *data64;
|
||||
const UINT32 *data32;
|
||||
UINT i;
|
||||
static const UINT64 padding64[] = // SHA2 IV
|
||||
{
|
||||
0x428A2F9871374491ull, 0xB5C0FBCFE9B5DBA5ull, 0x3956C25B59F111F1ull,
|
||||
0x923F82A4AB1C5ED5ull, 0xD807AA9812835B01ull, 0x243185BE550C7DC3ull,
|
||||
0x72BE5D7480DEB1FEull, 0x9BDC06A7C19BF174ull, 0xE49B69C1EFBE4786ull,
|
||||
0x428A2F9871374491ull, 0xB5C0FBCFE9B5DBA5ull, 0x3956C25B59F111F1ull,
|
||||
0x923F82A4AB1C5ED5ull, 0xD807AA9812835B01ull, 0x243185BE550C7DC3ull,
|
||||
0x72BE5D7480DEB1FEull, 0x9BDC06A7C19BF174ull, 0xE49B69C1EFBE4786ull,
|
||||
};
|
||||
|
||||
// Set-up seed & data
|
||||
v1 = seed ^ padding64[0];
|
||||
if (ip_header != NULL)
|
||||
{
|
||||
data64 = (UINT64 *)ip_header;
|
||||
data64 = (const UINT64 *)ip_header;
|
||||
v2 = data64[0] ^ padding64[1];
|
||||
v3 = data64[1] ^ padding64[2];
|
||||
data32 = (UINT32 *)ip_header;
|
||||
data32 = (const UINT32 *)ip_header;
|
||||
v4 = (UINT64)data32[4] ^ padding64[3];
|
||||
i = 0;
|
||||
}
|
||||
else if (ipv6_header != NULL)
|
||||
{
|
||||
data64 = (UINT64 *)ipv6_header;
|
||||
data64 = (const UINT64 *)ipv6_header;
|
||||
v2 = data64[0] ^ padding64[1];
|
||||
v3 = data64[1] ^ padding64[2];
|
||||
v4 = data64[2] ^ padding64[3];
|
||||
@@ -145,10 +147,10 @@ static UINT64 WinDivertHashPacket(UINT64 seed, PWINDIVERT_IPHDR ip_header,
|
||||
|
||||
if (tcp_header != NULL)
|
||||
{
|
||||
data64 = (UINT64 *)tcp_header;
|
||||
data64 = (const UINT64 *)tcp_header;
|
||||
v[i] = data64[0] ^ padding64[i+4]; i++;
|
||||
v[i] = data64[1] ^ padding64[i+4]; i++;
|
||||
data32 = (UINT32 *)tcp_header;
|
||||
data32 = (const UINT32 *)tcp_header;
|
||||
if (i <= 3)
|
||||
{
|
||||
v[i] = (UINT64)data32[4] ^ padding64[i+4]; i++;
|
||||
@@ -162,17 +164,17 @@ static UINT64 WinDivertHashPacket(UINT64 seed, PWINDIVERT_IPHDR ip_header,
|
||||
{
|
||||
if (udp_header != NULL)
|
||||
{
|
||||
data64 = (UINT64 *)udp_header;
|
||||
data64 = (const UINT64 *)udp_header;
|
||||
v[i] = data64[0] ^ padding64[i+4]; i++;
|
||||
}
|
||||
else if (icmp_header != NULL)
|
||||
{
|
||||
data64 = (UINT64 *)icmp_header;
|
||||
data64 = (const UINT64 *)icmp_header;
|
||||
v[i] = data64[0] ^ padding64[i+4]; i++;
|
||||
}
|
||||
else if (icmpv6_header != NULL)
|
||||
{
|
||||
data64 = (UINT64 *)icmpv6_header;
|
||||
data64 = (const UINT64 *)icmpv6_header;
|
||||
v[i] = data64[0] ^ padding64[i+4]; i++;
|
||||
}
|
||||
}
|
||||
@@ -187,14 +189,14 @@ static UINT64 WinDivertHashPacket(UINT64 seed, PWINDIVERT_IPHDR ip_header,
|
||||
v2 = WinDivertXXH64Round(v[1], v2);
|
||||
v3 = WinDivertXXH64Round(v[2], v3);
|
||||
v4 = WinDivertXXH64Round(v[3], v4);
|
||||
h64 = WINDIVERT_ROTL(v1, 1) + WINDIVERT_ROTL(v2, 7) +
|
||||
WINDIVERT_ROTL(v3, 12) + WINDIVERT_ROTL(v4, 18);
|
||||
h64 = WINDIVERT_ROTL64(v1, 1) + WINDIVERT_ROTL64(v2, 7) +
|
||||
WINDIVERT_ROTL64(v3, 12) + WINDIVERT_ROTL64(v4, 18);
|
||||
h64 = WinDivertXXH64MergeRound(h64, v1);
|
||||
h64 = WinDivertXXH64MergeRound(h64, v2);
|
||||
h64 = WinDivertXXH64MergeRound(h64, v3);
|
||||
h64 = WinDivertXXH64MergeRound(h64, v4);
|
||||
h64 += 32; // "length"
|
||||
h64 = WinDivertXXH64Avalanche(h64);
|
||||
h64 = WinDivertXXH64Avalanche(h64);
|
||||
|
||||
return h64;
|
||||
}
|
||||
|
||||
+808
-1472
File diff suppressed because it is too large
Load Diff
+1203
-207
File diff suppressed because it is too large
Load Diff
+25
-11
@@ -1,11 +1,11 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>WinDivert 2.0 Documentation</title>
|
||||
<title>WinDivert 2.2 Documentation</title>
|
||||
<meta charset="UTF-8"/>
|
||||
</head>
|
||||
<body>
|
||||
<h1>WinDivert 2.0: Windows Packet Divert</h1>
|
||||
<h1>WinDivert 2.2: Windows Packet Divert</h1>
|
||||
<h2>Table of Contents</h2>
|
||||
<ul>
|
||||
<li><a href="#introduction">1. Introduction</a></li>
|
||||
@@ -1135,6 +1135,19 @@ This flag is useful for querying the WinDivert state using a
|
||||
<code>WINDIVERT_LAYER_REFLECT</code> handle.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>WINDIVERT_FLAG_FRAGMENTS</code>
|
||||
</td>
|
||||
<td>
|
||||
If set, the handle will capture inbound IP fragments, but not inbound
|
||||
reassembled IP packets.
|
||||
Otherwise, if not set (the default), the handle will capture inbound
|
||||
reassembled IP packets, but not inbound IP fragments.
|
||||
This flag only affects inbound packets at the
|
||||
<code>WINDIVERT_LAYER_NETWORK</code> layer, else the flag is ignored.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
<p>
|
||||
@@ -2299,12 +2312,12 @@ Parses an IPv6 address stored in <code>addrStr</code>.
|
||||
If <code>pAddr</code> is non-<code>NULL</code>, the buffer assumed
|
||||
to be large enough to hold a 16-byte IPv6 address.
|
||||
The result is stored in host-byte-order.
|
||||
Use <a href="#divert_helper_hton"><code>WinDivertHelperHtonIpv6Address()</code></a>
|
||||
Use <a href="#divert_helper_hton"><code>WinDivertHelperHtonIPv6Address()</code></a>
|
||||
to convert the result into network-byte-order.
|
||||
</p>
|
||||
</dd></dl>
|
||||
|
||||
<a name="divert_helper_format_ipv4_address"><h3>6.11 WinDivertHelperParseIPv4Address</h3></a>
|
||||
<a name="divert_helper_format_ipv4_address"><h3>6.11 WinDivertHelperFormatIPv4Address</h3></a>
|
||||
<table border="1" cellpadding="5"><tr><td>
|
||||
<pre>
|
||||
BOOL <b>WinDivertHelperFormatIPv4Address</b>(
|
||||
@@ -2591,7 +2604,7 @@ UINT32 <b>WinDivertHelperNtohl</b>(
|
||||
UINT64 <b>WinDivertHelperNtohll</b>(
|
||||
__in UINT64 x
|
||||
);
|
||||
void <b>WinDivertHelperNtohIpv6Address</b>(
|
||||
void <b>WinDivertHelperNtohIPv6Address</b>(
|
||||
__in const UINT *inAddr,
|
||||
__out UINT *outAddr
|
||||
);
|
||||
@@ -2626,7 +2639,7 @@ UINT32 <b>WinDivertHelperHtonl</b>(
|
||||
UINT64 <b>WinDivertHelperHtonll</b>(
|
||||
__in UINT64 x
|
||||
);
|
||||
void <b>WinDivertHelperHtonIpv6Address</b>(
|
||||
void <b>WinDivertHelperHtonIPv6Address</b>(
|
||||
__in const UINT *inAddr,
|
||||
__out UINT *outAddr
|
||||
);
|
||||
@@ -2738,6 +2751,7 @@ The possible fields are:
|
||||
<tr><td><code>subIfIdx</code></td><td>✔</td><td>✔</td><td></td><td></td><td></td><td>Sub-interface index</td></tr>
|
||||
<tr><td><code>loopback</code></td><td>✔</td><td></td><td>✔</td><td>✔</td><td></td><td>Is loopback packet?</td></tr>
|
||||
<tr><td><code>impostor</code></td><td>✔</td><td>✔</td><td></td><td></td><td></td><td>Is impostor packet?</td></tr>
|
||||
<tr><td><code>fragment</code></td><td>✔</td><td>✔</td><td></td><td></td><td></td><td>Is IP fragment packet?</td></tr>
|
||||
<tr><td><code>endpointId</code></td><td></td><td></td><td>✔</td><td>✔</td><td></td><td>Endpoint ID</td></tr>
|
||||
<tr><td><code>parentEndpointId</code></td><td></td><td></td><td>✔</td><td>✔</td><td></td><td>Parent endpoint ID</td></tr>
|
||||
<tr><td><code>processId</code></td><td></td><td></td><td>✔</td><td>✔</td><td>✔</td><td>Process ID</td></tr>
|
||||
@@ -2849,11 +2863,11 @@ The possible macros are:
|
||||
for the <code>SOCKET</code> layer, or
|
||||
<code>WINDIVERT_EVENT_REFLECT_CLOSE</code> for the <code>REFLECT</code>
|
||||
layer.</td></tr>
|
||||
<tr><td><code>NETWORK</code></td><td></td><td></td><td></td><td></td><td>✔</td><td><code>WINDIVERT_LAYER_FLOW_NETWORK</code></td></tr>
|
||||
<tr><td><code>NETWORK_FORWARD</code></td><td></td><td></td><td></td><td></td><td>✔</td><td><code>WINDIVERT_LAYER_FLOW_NETWORK_FORWARD</code></td></tr>
|
||||
<tr><td><code>FLOW</code></td><td></td><td></td><td></td><td></td><td>✔</td><td><code>WINDIVERT_LAYER_FLOW_FLOW</code></td></tr>
|
||||
<tr><td><code>SOCKET</code></td><td></td><td></td><td></td><td></td><td>✔</td><td><code>WINDIVERT_LAYER_FLOW_SOCKET</code></td></tr>
|
||||
<tr><td><code>REFLECT</code></td><td></td><td></td><td></td><td></td><td>✔</td><td><code>WINDIVERT_LAYER_FLOW_REFLECT</code></td></tr>
|
||||
<tr><td><code>NETWORK</code></td><td></td><td></td><td></td><td></td><td>✔</td><td><code>WINDIVERT_LAYER_NETWORK</code></td></tr>
|
||||
<tr><td><code>NETWORK_FORWARD</code></td><td></td><td></td><td></td><td></td><td>✔</td><td><code>WINDIVERT_LAYER_NETWORK_FORWARD</code></td></tr>
|
||||
<tr><td><code>FLOW</code></td><td></td><td></td><td></td><td></td><td>✔</td><td><code>WINDIVERT_LAYER_FLOW</code></td></tr>
|
||||
<tr><td><code>SOCKET</code></td><td></td><td></td><td></td><td></td><td>✔</td><td><code>WINDIVERT_LAYER_SOCKET</code></td></tr>
|
||||
<tr><td><code>REFLECT</code></td><td></td><td></td><td></td><td></td><td>✔</td><td><code>WINDIVERT_LAYER_REFLECT</code></td></tr>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
|
||||
@@ -227,7 +227,7 @@ int __cdecl main(int argc, char **argv)
|
||||
filter = argv[1];
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "usage: %s [filter]\n");
|
||||
fprintf(stderr, "usage: %s [filter]\n", argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
|
||||
flowtrack.vcxproj
|
||||
(C) 2019, all rights reserved,
|
||||
|
||||
This file is part of WinDivert.
|
||||
|
||||
WinDivert is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU Lesser General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
WinDivert is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 2 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc., 51
|
||||
Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
-->
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="flowtrack.c">
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||
<AdditionalIncludeDirectories>..\..\include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<RootNamespace>flowtrack</RootNamespace>
|
||||
<ProjectName>flowtrack</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ItemDefinitionGroup>
|
||||
<Link>
|
||||
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\install\MSVC\i386\WinDivert.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\install\MSVC\amd64\WinDivert.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
</Project>
|
||||
@@ -51,7 +51,7 @@
|
||||
#define ntohs(x) WinDivertHelperNtohs(x)
|
||||
#define ntohl(x) WinDivertHelperNtohl(x)
|
||||
|
||||
#define MAXBUF 0xFFFF
|
||||
#define MAXBUF WINDIVERT_MTU_MAX
|
||||
#define INET6_ADDRSTRLEN 45
|
||||
|
||||
/*
|
||||
@@ -102,7 +102,7 @@ int __cdecl main(int argc, char **argv)
|
||||
|
||||
// Divert traffic matching the filter:
|
||||
handle = WinDivertOpen(argv[1], WINDIVERT_LAYER_NETWORK, priority,
|
||||
WINDIVERT_FLAG_SNIFF);
|
||||
WINDIVERT_FLAG_SNIFF | WINDIVERT_FLAG_FRAGMENTS);
|
||||
if (handle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
if (GetLastError() == ERROR_INVALID_PARAMETER &&
|
||||
@@ -197,8 +197,8 @@ int __cdecl main(int argc, char **argv)
|
||||
}
|
||||
if (ipv6_header != NULL)
|
||||
{
|
||||
WinDivertHelperNtohIpv6Address(ipv6_header->SrcAddr, src_addr);
|
||||
WinDivertHelperNtohIpv6Address(ipv6_header->DstAddr, dst_addr);
|
||||
WinDivertHelperNtohIPv6Address(ipv6_header->SrcAddr, src_addr);
|
||||
WinDivertHelperNtohIPv6Address(ipv6_header->DstAddr, dst_addr);
|
||||
WinDivertHelperFormatIPv6Address(src_addr, src_str,
|
||||
sizeof(src_str));
|
||||
WinDivertHelperFormatIPv6Address(dst_addr, dst_str,
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
|
||||
netdump.vcxproj
|
||||
(C) 2019, all rights reserved,
|
||||
|
||||
This file is part of WinDivert.
|
||||
|
||||
WinDivert is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU Lesser General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
WinDivert is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 2 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc., 51
|
||||
Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
-->
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="netdump.c">
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||
<AdditionalIncludeDirectories>..\..\include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<RootNamespace>netdump</RootNamespace>
|
||||
<ProjectName>netdump</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ItemDefinitionGroup>
|
||||
<Link>
|
||||
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\install\MSVC\i386\WinDivert.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\install\MSVC\amd64\WinDivert.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
</Project>
|
||||
@@ -59,7 +59,7 @@
|
||||
#define htons(x) WinDivertHelperHtons(x)
|
||||
#define htonl(x) WinDivertHelperHtonl(x)
|
||||
|
||||
#define MAXBUF 0xFFFF
|
||||
#define MAXBUF WINDIVERT_MTU_MAX
|
||||
#define INET6_ADDRSTRLEN 45
|
||||
#define IPPROTO_ICMPV6 58
|
||||
|
||||
@@ -223,8 +223,8 @@ int __cdecl main(int argc, char **argv)
|
||||
}
|
||||
if (ipv6_header != NULL)
|
||||
{
|
||||
WinDivertHelperNtohIpv6Address(ipv6_header->SrcAddr, src_addr);
|
||||
WinDivertHelperNtohIpv6Address(ipv6_header->DstAddr, dst_addr);
|
||||
WinDivertHelperNtohIPv6Address(ipv6_header->SrcAddr, src_addr);
|
||||
WinDivertHelperNtohIPv6Address(ipv6_header->DstAddr, dst_addr);
|
||||
WinDivertHelperFormatIPv6Address(src_addr, src_str,
|
||||
sizeof(src_str));
|
||||
WinDivertHelperFormatIPv6Address(dst_addr, dst_str,
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
|
||||
netfilter.vcxproj
|
||||
(C) 2019, all rights reserved,
|
||||
|
||||
This file is part of WinDivert.
|
||||
|
||||
WinDivert is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU Lesser General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
WinDivert is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 2 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc., 51
|
||||
Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
-->
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="netfilter.c">
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||
<AdditionalIncludeDirectories>..\..\include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<RootNamespace>netfilter</RootNamespace>
|
||||
<ProjectName>netfilter</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ItemDefinitionGroup>
|
||||
<Link>
|
||||
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\install\MSVC\i386\WinDivert.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\install\MSVC\amd64\WinDivert.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
</Project>
|
||||
@@ -147,7 +147,7 @@ int __cdecl main(int argc, char **argv)
|
||||
static DWORD passthru(LPVOID arg)
|
||||
{
|
||||
UINT8 *packet;
|
||||
UINT packet_len, addr_len;
|
||||
UINT packet_len, recv_len, addr_len;
|
||||
WINDIVERT_ADDRESS *addr;
|
||||
PCONFIG config = (PCONFIG)arg;
|
||||
HANDLE handle;
|
||||
@@ -156,7 +156,10 @@ static DWORD passthru(LPVOID arg)
|
||||
handle = config->handle;
|
||||
batch = config->batch;
|
||||
|
||||
packet = (UINT8 *)malloc(batch * MTU);
|
||||
packet_len = batch * MTU;
|
||||
packet_len =
|
||||
(packet_len < WINDIVERT_MTU_MAX? WINDIVERT_MTU_MAX: packet_len);
|
||||
packet = (UINT8 *)malloc(packet_len);
|
||||
addr = (WINDIVERT_ADDRESS *)malloc(batch * sizeof(WINDIVERT_ADDRESS));
|
||||
if (packet == NULL || addr == NULL)
|
||||
{
|
||||
@@ -169,9 +172,8 @@ static DWORD passthru(LPVOID arg)
|
||||
while (TRUE)
|
||||
{
|
||||
// Read a matching packet.
|
||||
packet_len = batch * MTU;
|
||||
addr_len = batch * sizeof(WINDIVERT_ADDRESS);
|
||||
if (!WinDivertRecvEx(handle, packet, packet_len, &packet_len, 0,
|
||||
addr_len = batch * sizeof(WINDIVERT_ADDRESS);
|
||||
if (!WinDivertRecvEx(handle, packet, packet_len, &recv_len, 0,
|
||||
addr, &addr_len, NULL))
|
||||
{
|
||||
fprintf(stderr, "warning: failed to read packet (%d)\n",
|
||||
@@ -180,7 +182,7 @@ static DWORD passthru(LPVOID arg)
|
||||
}
|
||||
|
||||
// Re-inject the matching packet.
|
||||
if (!WinDivertSendEx(handle, packet, packet_len, NULL, 0, addr,
|
||||
if (!WinDivertSendEx(handle, packet, recv_len, NULL, 0, addr,
|
||||
addr_len, NULL))
|
||||
{
|
||||
fprintf(stderr, "warning: failed to reinject packet (%d)\n",
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
|
||||
passthru.vcxproj
|
||||
(C) 2019, all rights reserved,
|
||||
|
||||
This file is part of WinDivert.
|
||||
|
||||
WinDivert is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU Lesser General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
WinDivert is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 2 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc., 51
|
||||
Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
-->
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="passthru.c">
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||
<AdditionalIncludeDirectories>..\..\include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<RootNamespace>passthru</RootNamespace>
|
||||
<ProjectName>passthru</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ItemDefinitionGroup>
|
||||
<Link>
|
||||
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\install\MSVC\i386\WinDivert.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\install\MSVC\amd64\WinDivert.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
</Project>
|
||||
@@ -88,8 +88,8 @@ int __cdecl main(int argc, char **argv)
|
||||
}
|
||||
// Fallthrough:
|
||||
default:
|
||||
fprintf(stderr, "usage: %s [filter]\n");
|
||||
fprintf(stderr, " %s --block [filter]\n");
|
||||
fprintf(stderr, "usage: %s [filter]\n", argv[0]);
|
||||
fprintf(stderr, " %s --block [filter]\n", argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
|
||||
socketdump.vcxproj
|
||||
(C) 2019, all rights reserved,
|
||||
|
||||
This file is part of WinDivert.
|
||||
|
||||
WinDivert is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU Lesser General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
WinDivert is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 2 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc., 51
|
||||
Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
-->
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="socketdump.c">
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||
<AdditionalIncludeDirectories>..\..\include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<RootNamespace>socketdump</RootNamespace>
|
||||
<ProjectName>socketdump</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ItemDefinitionGroup>
|
||||
<Link>
|
||||
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\install\MSVC\i386\WinDivert.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\install\MSVC\amd64\WinDivert.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
</Project>
|
||||
@@ -51,7 +51,7 @@
|
||||
|
||||
#include "windivert.h"
|
||||
|
||||
#define MAXBUF 0xFFFF
|
||||
#define MAXBUF WINDIVERT_MTU_MAX
|
||||
#define PROXY_PORT 34010
|
||||
#define ALT_PORT 43010
|
||||
#define MAX_LINE 65
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
|
||||
streamdump.vcxproj
|
||||
(C) 2019, all rights reserved,
|
||||
|
||||
This file is part of WinDivert.
|
||||
|
||||
WinDivert is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU Lesser General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
WinDivert is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 2 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc., 51
|
||||
Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
-->
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="streamdump.c">
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||
<AdditionalIncludeDirectories>..\..\include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<RootNamespace>streamdump</RootNamespace>
|
||||
<ProjectName>streamdump</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ItemDefinitionGroup>
|
||||
<Link>
|
||||
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\install\MSVC\i386\WinDivert.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\install\MSVC\amd64\WinDivert.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
</Project>
|
||||
@@ -53,8 +53,8 @@
|
||||
#define htons(x) WinDivertHelperHtons(x)
|
||||
#define htonl(x) WinDivertHelperHtonl(x)
|
||||
|
||||
#define MAXBUF 0xFFFF
|
||||
#define MAXURL 4096
|
||||
#define MAXBUF WINDIVERT_MTU_MAX
|
||||
#define MAXURL 4096
|
||||
|
||||
/*
|
||||
* URL and blacklist representation.
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
|
||||
webfilter.vcxproj
|
||||
(C) 2019, all rights reserved,
|
||||
|
||||
This file is part of WinDivert.
|
||||
|
||||
WinDivert is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU Lesser General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
WinDivert is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 2 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc., 51
|
||||
Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
-->
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="webfilter.c">
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||
<AdditionalIncludeDirectories>..\..\include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<RootNamespace>webfilter</RootNamespace>
|
||||
<ProjectName>webfilter</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ItemDefinitionGroup>
|
||||
<Link>
|
||||
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\install\MSVC\i386\WinDivert.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\install\MSVC\amd64\WinDivert.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
</Project>
|
||||
@@ -87,7 +87,7 @@ int __cdecl main(int argc, char **argv)
|
||||
{
|
||||
usage:
|
||||
fprintf(stderr, "usage: %s (list|watch|kill) [filter]\n", argv[0]);
|
||||
fprintf(stderr, " %s uninstall\n");
|
||||
fprintf(stderr, " %s uninstall\n", argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (strcmp(argv[1], "list") == 0)
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
|
||||
windivertctl.vcxproj
|
||||
(C) 2019, all rights reserved,
|
||||
|
||||
This file is part of WinDivert.
|
||||
|
||||
WinDivert is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU Lesser General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
WinDivert is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 2 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc., 51
|
||||
Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
-->
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="windivertctl.c">
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||
<AdditionalIncludeDirectories>..\..\include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<RootNamespace>windivertctl</RootNamespace>
|
||||
<ProjectName>windivertctl</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ItemDefinitionGroup>
|
||||
<Link>
|
||||
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\install\MSVC\i386\WinDivert.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\install\MSVC\amd64\WinDivert.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
</Project>
|
||||
+69
-41
@@ -40,7 +40,7 @@
|
||||
#endif /* WINDIVERT_KERNEL */
|
||||
|
||||
#ifndef WINDIVERTEXPORT
|
||||
#define WINDIVERTEXPORT __declspec(dllimport)
|
||||
#define WINDIVERTEXPORT extern __declspec(dllimport)
|
||||
#endif /* WINDIVERTEXPORT */
|
||||
|
||||
#ifdef __MINGW32__
|
||||
@@ -135,29 +135,37 @@ typedef struct
|
||||
/*
|
||||
* WinDivert address.
|
||||
*/
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4201)
|
||||
#endif
|
||||
typedef struct
|
||||
{
|
||||
INT64 Timestamp; /* Packet's timestamp. */
|
||||
UINT64 Layer:8; /* Packet's layer. */
|
||||
UINT64 Event:8; /* Packet event. */
|
||||
UINT64 Sniffed:1; /* Packet was sniffed? */
|
||||
UINT64 Outbound:1; /* Packet is outound? */
|
||||
UINT64 Loopback:1; /* Packet is loopback? */
|
||||
UINT64 Impostor:1; /* Packet is impostor? */
|
||||
UINT64 IPv6:1; /* Packet is IPv6? */
|
||||
UINT64 IPChecksum:1; /* Packet has valid IPv4 checksum? */
|
||||
UINT64 TCPChecksum:1; /* Packet has valid TCP checksum? */
|
||||
UINT64 UDPChecksum:1; /* Packet has valid UDP checksum? */
|
||||
UINT64 Reserved1:40;
|
||||
UINT32 Layer:8; /* Packet's layer. */
|
||||
UINT32 Event:8; /* Packet event. */
|
||||
UINT32 Sniffed:1; /* Packet was sniffed? */
|
||||
UINT32 Outbound:1; /* Packet is outound? */
|
||||
UINT32 Loopback:1; /* Packet is loopback? */
|
||||
UINT32 Impostor:1; /* Packet is impostor? */
|
||||
UINT32 IPv6:1; /* Packet is IPv6? */
|
||||
UINT32 IPChecksum:1; /* Packet has valid IPv4 checksum? */
|
||||
UINT32 TCPChecksum:1; /* Packet has valid TCP checksum? */
|
||||
UINT32 UDPChecksum:1; /* Packet has valid UDP checksum? */
|
||||
UINT32 Reserved1:8;
|
||||
UINT32 Reserved2;
|
||||
union
|
||||
{
|
||||
WINDIVERT_DATA_NETWORK Network; /* Network layer data. */
|
||||
WINDIVERT_DATA_FLOW Flow; /* Flow layer data. */
|
||||
WINDIVERT_DATA_SOCKET Socket; /* Socket layer data. */
|
||||
WINDIVERT_DATA_REFLECT Reflect; /* Reflect layer data. */
|
||||
UINT8 Reserved2[64];
|
||||
UINT8 Reserved3[64];
|
||||
};
|
||||
} WINDIVERT_ADDRESS, *PWINDIVERT_ADDRESS;
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* WinDivert events.
|
||||
@@ -187,6 +195,7 @@ typedef enum
|
||||
#define WINDIVERT_FLAG_SEND_ONLY 0x0008
|
||||
#define WINDIVERT_FLAG_WRITE_ONLY WINDIVERT_FLAG_SEND_ONLY
|
||||
#define WINDIVERT_FLAG_NO_INSTALL 0x0010
|
||||
#define WINDIVERT_FLAG_FRAGMENTS 0x0020
|
||||
|
||||
/*
|
||||
* WinDivert parameters.
|
||||
@@ -217,7 +226,7 @@ typedef enum
|
||||
/*
|
||||
* Open a WinDivert handle.
|
||||
*/
|
||||
extern WINDIVERTEXPORT HANDLE WinDivertOpen(
|
||||
WINDIVERTEXPORT HANDLE WinDivertOpen(
|
||||
__in const char *filter,
|
||||
__in WINDIVERT_LAYER layer,
|
||||
__in INT16 priority,
|
||||
@@ -226,7 +235,7 @@ extern WINDIVERTEXPORT HANDLE WinDivertOpen(
|
||||
/*
|
||||
* Receive (read) a packet from a WinDivert handle.
|
||||
*/
|
||||
extern WINDIVERTEXPORT BOOL WinDivertRecv(
|
||||
WINDIVERTEXPORT BOOL WinDivertRecv(
|
||||
__in HANDLE handle,
|
||||
__out_opt VOID *pPacket,
|
||||
__in UINT packetLen,
|
||||
@@ -236,7 +245,7 @@ extern WINDIVERTEXPORT BOOL WinDivertRecv(
|
||||
/*
|
||||
* Receive (read) a packet from a WinDivert handle.
|
||||
*/
|
||||
extern WINDIVERTEXPORT BOOL WinDivertRecvEx(
|
||||
WINDIVERTEXPORT BOOL WinDivertRecvEx(
|
||||
__in HANDLE handle,
|
||||
__out_opt VOID *pPacket,
|
||||
__in UINT packetLen,
|
||||
@@ -249,7 +258,7 @@ extern WINDIVERTEXPORT BOOL WinDivertRecvEx(
|
||||
/*
|
||||
* Send (write/inject) a packet to a WinDivert handle.
|
||||
*/
|
||||
extern WINDIVERTEXPORT BOOL WinDivertSend(
|
||||
WINDIVERTEXPORT BOOL WinDivertSend(
|
||||
__in HANDLE handle,
|
||||
__in const VOID *pPacket,
|
||||
__in UINT packetLen,
|
||||
@@ -259,7 +268,7 @@ extern WINDIVERTEXPORT BOOL WinDivertSend(
|
||||
/*
|
||||
* Send (write/inject) a packet to a WinDivert handle.
|
||||
*/
|
||||
extern WINDIVERTEXPORT BOOL WinDivertSendEx(
|
||||
WINDIVERTEXPORT BOOL WinDivertSendEx(
|
||||
__in HANDLE handle,
|
||||
__in const VOID *pPacket,
|
||||
__in UINT packetLen,
|
||||
@@ -272,20 +281,20 @@ extern WINDIVERTEXPORT BOOL WinDivertSendEx(
|
||||
/*
|
||||
* Shutdown a WinDivert handle.
|
||||
*/
|
||||
extern WINDIVERTEXPORT BOOL WinDivertShutdown(
|
||||
WINDIVERTEXPORT BOOL WinDivertShutdown(
|
||||
__in HANDLE handle,
|
||||
__in WINDIVERT_SHUTDOWN how);
|
||||
|
||||
/*
|
||||
* Close a WinDivert handle.
|
||||
*/
|
||||
extern WINDIVERTEXPORT BOOL WinDivertClose(
|
||||
WINDIVERTEXPORT BOOL WinDivertClose(
|
||||
__in HANDLE handle);
|
||||
|
||||
/*
|
||||
* Set a WinDivert handle parameter.
|
||||
*/
|
||||
extern WINDIVERTEXPORT BOOL WinDivertSetParam(
|
||||
WINDIVERTEXPORT BOOL WinDivertSetParam(
|
||||
__in HANDLE handle,
|
||||
__in WINDIVERT_PARAM param,
|
||||
__in UINT64 value);
|
||||
@@ -293,7 +302,7 @@ extern WINDIVERTEXPORT BOOL WinDivertSetParam(
|
||||
/*
|
||||
* Get a WinDivert handle parameter.
|
||||
*/
|
||||
extern WINDIVERTEXPORT BOOL WinDivertGetParam(
|
||||
WINDIVERTEXPORT BOOL WinDivertGetParam(
|
||||
__in HANDLE handle,
|
||||
__in WINDIVERT_PARAM param,
|
||||
__out UINT64 *pValue);
|
||||
@@ -321,6 +330,11 @@ extern WINDIVERTEXPORT BOOL WinDivertGetParam(
|
||||
/* WINDIVERT HELPER API */
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4214)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* IPv4/IPv6/ICMP/ICMPv6/TCP/UDP header definitions.
|
||||
*/
|
||||
@@ -455,6 +469,10 @@ typedef struct
|
||||
UINT16 Checksum;
|
||||
} WINDIVERT_UDPHDR, *PWINDIVERT_UDPHDR;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Flags for WinDivertHelperCalcChecksums()
|
||||
*/
|
||||
@@ -469,7 +487,7 @@ typedef struct
|
||||
/*
|
||||
* Hash a packet.
|
||||
*/
|
||||
extern WINDIVERTEXPORT UINT64 WinDivertHelperHashPacket(
|
||||
WINDIVERTEXPORT UINT64 WinDivertHelperHashPacket(
|
||||
__in const VOID *pPacket,
|
||||
__in UINT packetLen,
|
||||
__in UINT64 seed
|
||||
@@ -481,7 +499,7 @@ extern WINDIVERTEXPORT UINT64 WinDivertHelperHashPacket(
|
||||
/*
|
||||
* Parse IPv4/IPv6/ICMP/ICMPv6/TCP/UDP headers from a raw packet.
|
||||
*/
|
||||
extern WINDIVERTEXPORT BOOL WinDivertHelperParsePacket(
|
||||
WINDIVERTEXPORT BOOL WinDivertHelperParsePacket(
|
||||
__in const VOID *pPacket,
|
||||
__in UINT packetLen,
|
||||
__out_opt PWINDIVERT_IPHDR *ppIpHdr,
|
||||
@@ -499,21 +517,21 @@ extern WINDIVERTEXPORT BOOL WinDivertHelperParsePacket(
|
||||
/*
|
||||
* Parse an IPv4 address.
|
||||
*/
|
||||
extern WINDIVERTEXPORT BOOL WinDivertHelperParseIPv4Address(
|
||||
WINDIVERTEXPORT BOOL WinDivertHelperParseIPv4Address(
|
||||
__in const char *addrStr,
|
||||
__out_opt UINT32 *pAddr);
|
||||
|
||||
/*
|
||||
* Parse an IPv6 address.
|
||||
*/
|
||||
extern WINDIVERTEXPORT BOOL WinDivertHelperParseIPv6Address(
|
||||
WINDIVERTEXPORT BOOL WinDivertHelperParseIPv6Address(
|
||||
__in const char *addrStr,
|
||||
__out_opt UINT32 *pAddr);
|
||||
|
||||
/*
|
||||
* Format an IPv4 address.
|
||||
*/
|
||||
extern WINDIVERTEXPORT BOOL WinDivertHelperFormatIPv4Address(
|
||||
WINDIVERTEXPORT BOOL WinDivertHelperFormatIPv4Address(
|
||||
__in UINT32 addr,
|
||||
__out char *buffer,
|
||||
__in UINT bufLen);
|
||||
@@ -521,7 +539,7 @@ extern WINDIVERTEXPORT BOOL WinDivertHelperFormatIPv4Address(
|
||||
/*
|
||||
* Format an IPv6 address.
|
||||
*/
|
||||
extern WINDIVERTEXPORT BOOL WinDivertHelperFormatIPv6Address(
|
||||
WINDIVERTEXPORT BOOL WinDivertHelperFormatIPv6Address(
|
||||
__in const UINT32 *pAddr,
|
||||
__out char *buffer,
|
||||
__in UINT bufLen);
|
||||
@@ -529,7 +547,7 @@ extern WINDIVERTEXPORT BOOL WinDivertHelperFormatIPv6Address(
|
||||
/*
|
||||
* Calculate IPv4/IPv6/ICMP/ICMPv6/TCP/UDP checksums.
|
||||
*/
|
||||
extern WINDIVERTEXPORT BOOL WinDivertHelperCalcChecksums(
|
||||
WINDIVERTEXPORT BOOL WinDivertHelperCalcChecksums(
|
||||
__inout VOID *pPacket,
|
||||
__in UINT packetLen,
|
||||
__out_opt WINDIVERT_ADDRESS *pAddr,
|
||||
@@ -538,14 +556,14 @@ extern WINDIVERTEXPORT BOOL WinDivertHelperCalcChecksums(
|
||||
/*
|
||||
* Decrement the TTL/HopLimit.
|
||||
*/
|
||||
extern WINDIVERTEXPORT BOOL WinDivertHelperDecrementTTL(
|
||||
WINDIVERTEXPORT BOOL WinDivertHelperDecrementTTL(
|
||||
__inout VOID *pPacket,
|
||||
__in UINT packetLen);
|
||||
|
||||
/*
|
||||
* Compile the given filter string.
|
||||
*/
|
||||
extern WINDIVERTEXPORT BOOL WinDivertHelperCompileFilter(
|
||||
WINDIVERTEXPORT BOOL WinDivertHelperCompileFilter(
|
||||
__in const char *filter,
|
||||
__in WINDIVERT_LAYER layer,
|
||||
__out_opt char *object,
|
||||
@@ -556,7 +574,7 @@ extern WINDIVERTEXPORT BOOL WinDivertHelperCompileFilter(
|
||||
/*
|
||||
* Evaluate the given filter string.
|
||||
*/
|
||||
extern WINDIVERTEXPORT BOOL WinDivertHelperEvalFilter(
|
||||
WINDIVERTEXPORT BOOL WinDivertHelperEvalFilter(
|
||||
__in const char *filter,
|
||||
__in const VOID *pPacket,
|
||||
__in UINT packetLen,
|
||||
@@ -565,7 +583,7 @@ extern WINDIVERTEXPORT BOOL WinDivertHelperEvalFilter(
|
||||
/*
|
||||
* Format the given filter string.
|
||||
*/
|
||||
extern WINDIVERTEXPORT BOOL WinDivertHelperFormatFilter(
|
||||
WINDIVERTEXPORT BOOL WinDivertHelperFormatFilter(
|
||||
__in const char *filter,
|
||||
__in WINDIVERT_LAYER layer,
|
||||
__out char *buffer,
|
||||
@@ -574,22 +592,32 @@ extern WINDIVERTEXPORT BOOL WinDivertHelperFormatFilter(
|
||||
/*
|
||||
* Byte ordering.
|
||||
*/
|
||||
extern WINDIVERTEXPORT UINT16 WinDivertHelperNtohs(
|
||||
WINDIVERTEXPORT UINT16 WinDivertHelperNtohs(
|
||||
__in UINT16 x);
|
||||
extern WINDIVERTEXPORT UINT16 WinDivertHelperHtons(
|
||||
WINDIVERTEXPORT UINT16 WinDivertHelperHtons(
|
||||
__in UINT16 x);
|
||||
extern WINDIVERTEXPORT UINT32 WinDivertHelperNtohl(
|
||||
WINDIVERTEXPORT UINT32 WinDivertHelperNtohl(
|
||||
__in UINT32 x);
|
||||
extern WINDIVERTEXPORT UINT32 WinDivertHelperHtonl(
|
||||
WINDIVERTEXPORT UINT32 WinDivertHelperHtonl(
|
||||
__in UINT32 x);
|
||||
extern WINDIVERTEXPORT UINT64 WinDivertHelperNtohll(
|
||||
WINDIVERTEXPORT UINT64 WinDivertHelperNtohll(
|
||||
__in UINT64 x);
|
||||
extern WINDIVERTEXPORT UINT64 WinDivertHelperHtonll(
|
||||
WINDIVERTEXPORT UINT64 WinDivertHelperHtonll(
|
||||
__in UINT64 x);
|
||||
extern WINDIVERTEXPORT void WinDivertHelperNtohIpv6Address(
|
||||
WINDIVERTEXPORT void WinDivertHelperNtohIPv6Address(
|
||||
__in const UINT *inAddr,
|
||||
__out UINT *outAddr);
|
||||
extern WINDIVERTEXPORT void WinDivertHelperHtonIpv6Address(
|
||||
WINDIVERTEXPORT void WinDivertHelperHtonIPv6Address(
|
||||
__in const UINT *inAddr,
|
||||
__out UINT *outAddr);
|
||||
|
||||
/*
|
||||
* Old names to be removed in the next version.
|
||||
*/
|
||||
WINDIVERTEXPORT void WinDivertHelperNtohIpv6Address(
|
||||
__in const UINT *inAddr,
|
||||
__out UINT *outAddr);
|
||||
WINDIVERTEXPORT void WinDivertHelperHtonIpv6Address(
|
||||
__in const UINT *inAddr,
|
||||
__out UINT *outAddr);
|
||||
|
||||
|
||||
+12
-10
@@ -38,14 +38,14 @@
|
||||
/*
|
||||
* NOTE: This is the low-level interface to the WinDivert device driver.
|
||||
* This interface should not be used directly, instead use the high-level
|
||||
* interface provided by the divert API.
|
||||
* interface provided by the WinDivert API.
|
||||
*/
|
||||
|
||||
#define WINDIVERT_KERNEL
|
||||
#include "windivert.h"
|
||||
|
||||
#define WINDIVERT_VERSION_MAJOR 2
|
||||
#define WINDIVERT_VERSION_MINOR 0
|
||||
#define WINDIVERT_VERSION_MINOR 2
|
||||
|
||||
#define WINDIVERT_MAGIC_DLL 0x4C4C447669645724ull
|
||||
#define WINDIVERT_MAGIC_SYS 0x5359537669645723ull
|
||||
@@ -149,8 +149,9 @@
|
||||
#define WINDIVERT_FILTER_FIELD_RANDOM8 82
|
||||
#define WINDIVERT_FILTER_FIELD_RANDOM16 83
|
||||
#define WINDIVERT_FILTER_FIELD_RANDOM32 84
|
||||
#define WINDIVERT_FILTER_FIELD_FRAGMENT 85
|
||||
#define WINDIVERT_FILTER_FIELD_MAX \
|
||||
WINDIVERT_FILTER_FIELD_RANDOM32
|
||||
WINDIVERT_FILTER_FIELD_FRAGMENT
|
||||
|
||||
#define WINDIVERT_FILTER_TEST_EQ 0
|
||||
#define WINDIVERT_FILTER_TEST_NEQ 1
|
||||
@@ -181,7 +182,8 @@
|
||||
*/
|
||||
#define WINDIVERT_FLAGS_ALL \
|
||||
(WINDIVERT_FLAG_SNIFF | WINDIVERT_FLAG_DROP | WINDIVERT_FLAG_RECV_ONLY |\
|
||||
WINDIVERT_FLAG_SEND_ONLY | WINDIVERT_FLAG_NO_INSTALL)
|
||||
WINDIVERT_FLAG_SEND_ONLY | WINDIVERT_FLAG_NO_INSTALL | \
|
||||
WINDIVERT_FLAG_FRAGMENTS)
|
||||
#define WINDIVERT_FLAGS_EXCLUDE(flags, flag1, flag2) \
|
||||
(((flags) & ((flag1) | (flag2))) != ((flag1) | (flag2)))
|
||||
#define WINDIVERT_FLAGS_VALID(flags) \
|
||||
@@ -287,12 +289,12 @@ typedef struct
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
UINT16 field:11; // WINDIVERT_FILTER_FIELD_*
|
||||
UINT16 test:5; // WINDIVERT_FILTER_TEST_*
|
||||
UINT16 success; // Success continuation.
|
||||
UINT16 failure; // Fail continuation.
|
||||
UINT16 neg:1; // Argument negative?
|
||||
UINT16 reserved:15;
|
||||
UINT32 field:11; // WINDIVERT_FILTER_FIELD_*
|
||||
UINT32 test:5; // WINDIVERT_FILTER_TEST_*
|
||||
UINT32 success:16; // Success continuation.
|
||||
UINT32 failure:16; // Fail continuation.
|
||||
UINT32 neg:1; // Argument negative?
|
||||
UINT32 reserved:15;
|
||||
UINT32 arg[4]; // Argument.
|
||||
} WINDIVERT_FILTER, *PWINDIVERT_FILTER;
|
||||
#pragma pack(pop)
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ Class = WFPCALLOUTS
|
||||
ClassGuid = {57465043-616C-6C6F-7574-5F636C617373}
|
||||
Provider = %Basil%
|
||||
CatalogFile = WinDivert32.Cat
|
||||
DriverVer = 01/01/2019,2.0.0
|
||||
DriverVer = 08/08/2019,2.2.0
|
||||
|
||||
[SourceDisksNames]
|
||||
1 = %DiskName%
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ Class = WFPCALLOUTS
|
||||
ClassGuid = {57465043-616C-6C6F-7574-5F636C617373}
|
||||
Provider = %Basil%
|
||||
CatalogFile = WinDivert64.Cat
|
||||
DriverVer = 01/01/2019,2.0.0
|
||||
DriverVer = 08/08/2019,2.2.0
|
||||
|
||||
[SourceDisksNames]
|
||||
1 = %DiskName%
|
||||
|
||||
+6
-6
@@ -33,7 +33,7 @@
|
||||
# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
# Script for MinGW/Linux cross compilation.
|
||||
# NOTE: run wddk-build.bat before this script.
|
||||
# NOTE: run msvc-build.bat before this script.
|
||||
|
||||
set -e
|
||||
|
||||
@@ -41,7 +41,7 @@ ENVS="i686-w64-mingw32 x86_64-w64-mingw32"
|
||||
|
||||
if [ "$1" = "debug" ]
|
||||
then
|
||||
MSVCRT=-lmsvcrt
|
||||
EXTRA_OPTS="-lmsvcrt -include stdio.h"
|
||||
fi
|
||||
|
||||
for ENV in $ENVS
|
||||
@@ -57,16 +57,16 @@ do
|
||||
MANGLE=
|
||||
fi
|
||||
HAVE_SYS=yes
|
||||
if [ ! -d install/WDDK/$CPU ]
|
||||
if [ ! -d install/MSVC/$CPU ]
|
||||
then
|
||||
echo "WARNING: missing WDDK build; run wddk-build.bat first"
|
||||
echo "WARNING: missing MSVC build; run msvc-build.bat first"
|
||||
HAVE_SYS=no
|
||||
fi
|
||||
echo "BUILD MINGW-$CPU"
|
||||
CC="$ENV-gcc"
|
||||
COPTS="-fno-ident -shared -Wall -Wno-pointer-to-int-cast -Os -Iinclude/
|
||||
-Wl,--enable-stdcall-fixup -Wl,--entry=${MANGLE}WinDivertDllEntry"
|
||||
CLIBS="-lgcc -lkernel32 -ladvapi32 $MSVCRT"
|
||||
CLIBS="-lkernel32 -ladvapi32 $EXTRA_OPTS"
|
||||
STRIP="$ENV-strip"
|
||||
DLLTOOL="$ENV-dlltool"
|
||||
if [ -x "`which $CC`" ]
|
||||
@@ -121,7 +121,7 @@ do
|
||||
if [ $HAVE_SYS = yes ]
|
||||
then
|
||||
echo "\tcopy install/MINGW/$CPU/WinDivert$BITS.sys..."
|
||||
cp install/WDDK/$CPU/WinDivert$BITS.sys install/MINGW/$CPU
|
||||
cp install/MSVC/$CPU/WinDivert$BITS.sys install/MINGW/$CPU
|
||||
fi
|
||||
else
|
||||
echo "WARNING: $CC not found"
|
||||
|
||||
+150
@@ -0,0 +1,150 @@
|
||||
:: msvc-build.bat
|
||||
:: (C) 2019, all rights reserved,
|
||||
::
|
||||
:: This file is part of WinDivert.
|
||||
::
|
||||
:: WinDivert is free software: you can redistribute it and/or modify it under
|
||||
:: the terms of the GNU Lesser General Public License as published by the
|
||||
:: Free Software Foundation, either version 3 of the License, or (at your
|
||||
:: option) any later version.
|
||||
::
|
||||
:: This program is distributed in the hope that it will be useful, but
|
||||
:: WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
:: or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
:: License for more details.
|
||||
::
|
||||
:: You should have received a copy of the GNU Lesser General Public License
|
||||
:: along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
::
|
||||
:: WinDivert is free software; you can redistribute it and/or modify it under
|
||||
:: the terms of the GNU General Public License as published by the Free
|
||||
:: Software Foundation; either version 2 of the License, or (at your option)
|
||||
:: any later version.
|
||||
::
|
||||
:: This program is distributed in the hope that it will be useful, but
|
||||
:: WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
:: or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
:: for more details.
|
||||
::
|
||||
:: You should have received a copy of the GNU General Public License along
|
||||
:: with this program; if not, write to the Free Software Foundation, Inc., 51
|
||||
:: Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
@echo off
|
||||
|
||||
msbuild sys\windivert.vcxproj ^
|
||||
/p:Configuration=Release ^
|
||||
/p:platform=Win32 ^
|
||||
/p:SignMode=Off ^
|
||||
/p:OutDir=..\install\MSVC\i386\ ^
|
||||
/p:AssemblyName=WinDivert32
|
||||
|
||||
msbuild sys\windivert.vcxproj ^
|
||||
/p:Configuration=Release ^
|
||||
/p:platform=x64 ^
|
||||
/p:SignMode=Off ^
|
||||
/p:OutDir=..\install\MSVC\amd64\ ^
|
||||
/p:AssemblyName=WinDivert64
|
||||
|
||||
msbuild dll\windivert.vcxproj ^
|
||||
/p:Configuration=Release ^
|
||||
/p:platform=Win32 ^
|
||||
/p:OutDir=..\install\MSVC\i386\
|
||||
move dll\WinDivert.lib install\MSVC\i386\.
|
||||
|
||||
msbuild dll\windivert.vcxproj ^
|
||||
/p:Configuration=Release ^
|
||||
/p:platform=x64 ^
|
||||
/p:OutDir=..\install\MSVC\amd64\
|
||||
move dll\WinDivert.lib install\MSVC\amd64\.
|
||||
|
||||
msbuild examples\flowtrack\flowtrack.vcxproj ^
|
||||
/p:Configuration=Release ^
|
||||
/p:Platform=Win32 ^
|
||||
/p:OutDir=..\..\install\MSVC\i386\
|
||||
|
||||
msbuild examples\flowtrack\flowtrack.vcxproj ^
|
||||
/p:Configuration=Release ^
|
||||
/p:Platform=x64 ^
|
||||
/p:OutDir=..\..\install\MSVC\amd64\
|
||||
|
||||
msbuild examples\netdump\netdump.vcxproj ^
|
||||
/p:Configuration=Release ^
|
||||
/p:Platform=Win32 ^
|
||||
/p:OutDir=..\..\install\MSVC\i386\
|
||||
|
||||
msbuild examples\netdump\netdump.vcxproj ^
|
||||
/p:Configuration=Release ^
|
||||
/p:Platform=x64 ^
|
||||
/p:OutDir=..\..\install\MSVC\amd64\
|
||||
|
||||
msbuild examples\netfilter\netfilter.vcxproj ^
|
||||
/p:Configuration=Release ^
|
||||
/p:Platform=Win32 ^
|
||||
/p:OutDir=..\..\install\MSVC\i386\
|
||||
|
||||
msbuild examples\netfilter\netfilter.vcxproj ^
|
||||
/p:Configuration=Release ^
|
||||
/p:Platform=x64 ^
|
||||
/p:OutDir=..\..\install\MSVC\amd64\
|
||||
|
||||
msbuild examples\passthru\passthru.vcxproj ^
|
||||
/p:Configuration=Release ^
|
||||
/p:Platform=Win32 ^
|
||||
/p:OutDir=..\..\install\MSVC\i386\
|
||||
|
||||
msbuild examples\passthru\passthru.vcxproj ^
|
||||
/p:Configuration=Release ^
|
||||
/p:Platform=x64 ^
|
||||
/p:OutDir=..\..\install\MSVC\amd64\
|
||||
|
||||
msbuild examples\socketdump\socketdump.vcxproj ^
|
||||
/p:Configuration=Release ^
|
||||
/p:Platform=Win32 ^
|
||||
/p:OutDir=..\..\install\MSVC\i386\
|
||||
|
||||
msbuild examples\socketdump\socketdump.vcxproj ^
|
||||
/p:Configuration=Release ^
|
||||
/p:Platform=x64 ^
|
||||
/p:OutDir=..\..\install\MSVC\amd64\
|
||||
|
||||
msbuild examples\streamdump\streamdump.vcxproj ^
|
||||
/p:Configuration=Release ^
|
||||
/p:Platform=Win32 ^
|
||||
/p:OutDir=..\..\install\MSVC\i386\
|
||||
|
||||
msbuild examples\streamdump\streamdump.vcxproj ^
|
||||
/p:Configuration=Release ^
|
||||
/p:Platform=x64 ^
|
||||
/p:OutDir=..\..\install\MSVC\amd64\
|
||||
|
||||
msbuild examples\webfilter\webfilter.vcxproj ^
|
||||
/p:Configuration=Release ^
|
||||
/p:Platform=Win32 ^
|
||||
/p:OutDir=..\..\install\MSVC\i386\
|
||||
|
||||
msbuild examples\webfilter\webfilter.vcxproj ^
|
||||
/p:Configuration=Release ^
|
||||
/p:Platform=x64 ^
|
||||
/p:OutDir=..\..\install\MSVC\amd64\
|
||||
|
||||
msbuild examples\windivertctl\windivertctl.vcxproj ^
|
||||
/p:Configuration=Release ^
|
||||
/p:Platform=Win32 ^
|
||||
/p:OutDir=..\..\install\MSVC\i386\
|
||||
|
||||
msbuild examples\windivertctl\windivertctl.vcxproj ^
|
||||
/p:Configuration=Release ^
|
||||
/p:Platform=x64 ^
|
||||
/p:OutDir=..\..\install\MSVC\amd64\
|
||||
|
||||
msbuild test\test.vcxproj ^
|
||||
/p:Configuration=Release ^
|
||||
/p:Platform=Win32 ^
|
||||
/p:OutDir=..\install\MSVC\i386\
|
||||
|
||||
msbuild test\test.vcxproj ^
|
||||
/p:Configuration=Release ^
|
||||
/p:Platform=x64 ^
|
||||
/p:OutDir=..\install\MSVC\amd64\
|
||||
|
||||
+1
-1
@@ -90,7 +90,7 @@ if ! grep "DigiCert High Assurance EV Root" $INSTALL/x86/WinDivert32.sys \
|
||||
then
|
||||
echo "\t\033[33mWARNING\033[0m: unsigned WinDivert32.sys..."
|
||||
fi
|
||||
if [ -d "$WINDIVERT64_SYS" ]
|
||||
if [ -e "$WINDIVERT64_SYS" ]
|
||||
then
|
||||
echo "\tcopy $INSTALL/x64/WinDivert64.sys..."
|
||||
cp "$WINDIVERT64_SYS" $INSTALL/x86
|
||||
|
||||
+987
-1343
File diff suppressed because it is too large
Load Diff
+6
-4
@@ -35,23 +35,25 @@
|
||||
#include <windows.h>
|
||||
#include <ntverp.h>
|
||||
|
||||
#include "windivert_log.rc"
|
||||
|
||||
#define VER_FILETYPE VFT_DRV
|
||||
#define VER_FILESUBTYPE VFT2_DRV_NETWORK
|
||||
#define VER_FILEDESCRIPTION_STR \
|
||||
"The WinDivert 2.0 driver " \
|
||||
"The WinDivert 2.2 driver " \
|
||||
"[URL: https://reqrypt.org/windivert.html] " \
|
||||
"[Bitcoin: 1C5vZVSbizPeZ8ydTYhUfm4LA2cNwBfcYh]"
|
||||
#define VER_INTERNALNAME_STR "WinDivert.sys"
|
||||
#define VER_ORIGINALFILENAME_STR "WinDivert.sys"
|
||||
#define VER_PRODUCTVERSION 2.0
|
||||
#define VER_PRODUCTVERSION_STR "2.0"
|
||||
#define VER_PRODUCTVERSION 2.2
|
||||
#define VER_PRODUCTVERSION_STR "2.2"
|
||||
#define VER_COMPANYNAME_STR "Basil"
|
||||
#define VER_LEGALCOPYRIGHT_YEARS "2011-2019"
|
||||
#define VER_LEGALCOPYRIGHT_STR \
|
||||
"Copyright \251 " VER_COMPANYNAME_STR " " VER_LEGALCOPYRIGHT_YEARS
|
||||
#define VER_FILEVERSION VER_PRODUCTVERSION
|
||||
#define VER_FILEVERSION_STR VER_PRODUCTVERSION_STR
|
||||
#define VER_PRODUCTNAME_STR "WinDivert 2.0 driver"
|
||||
#define VER_PRODUCTNAME_STR "WinDivert 2.2 driver"
|
||||
|
||||
#include "common.ver"
|
||||
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
|
||||
windivert.vcxproj
|
||||
(C) 2019, all rights reserved,
|
||||
|
||||
This file is part of WinDivert.
|
||||
|
||||
WinDivert is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU Lesser General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
WinDivert is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 2 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc., 51
|
||||
Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
-->
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<MessageCompile Include="windivert_log.mc">
|
||||
<RCFilePath>.</RCFilePath>
|
||||
<HeaderFilePath>.</HeaderFilePath>
|
||||
</MessageCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="windivert.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="windivert.c">
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<AdditionalIncludeDirectories>..\include;..\dll;.</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion>
|
||||
<RootNamespace>WinDivert</RootNamespace>
|
||||
<ProjectName>WinDivert</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
|
||||
<PropertyGroup Label="Configuration">
|
||||
<TargetVersion>Windows7</TargetVersion>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
|
||||
<ConfigurationType>Driver</ConfigurationType>
|
||||
<DriverType>KMDF</DriverType>
|
||||
<DriverTargetPlatform>Desktop</DriverTargetPlatform>
|
||||
<DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
|
||||
<EnableInf2cat>false</EnableInf2cat>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<WppEnabled>false</WppEnabled>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_X86_=1;i386=1;STD_CALL;%(PreprocessorDefinitions);NDIS60;UNICODE;_UNICODE;NDIS_SUPPORT_NDIS60;NT;BINARY_COMPATIBLE=0</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">_WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions);NDIS60;UNICODE;_UNICODE;NDIS_SUPPORT_NDIS60;NT;BINARY_COMPATIBLE=0</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>%(AdditionalDependencies);$(KernelBufferOverflowLib);$(DDK_LIB_PATH)ntoskrnl.lib;$(DDK_LIB_PATH)hal.lib;$(DDK_LIB_PATH)wmilib.lib;$(KMDF_LIB_PATH)$(KMDF_VER_PATH)\WdfLdr.lib;$(KMDF_LIB_PATH)$(KMDF_VER_PATH)\WdfDriverEntry.lib;$(DDK_LIB_PATH)\wdmsec.lib;$(DDK_LIB_PATH)\ndis.lib;$(DDK_LIB_PATH)\fwpkclnt.lib;$(SDK_LIB_PATH)\uuid.lib</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
</Project>
|
||||
@@ -0,0 +1,59 @@
|
||||
;/*
|
||||
; * windivert_log.mc
|
||||
; * (C) 2019, all rights reserved,
|
||||
; *
|
||||
; * This file is part of WinDivert.
|
||||
; *
|
||||
; * WinDivert is free software: you can redistribute it and/or modify it under
|
||||
; * the terms of the GNU Lesser General Public License as published by the
|
||||
; * Free Software Foundation, either version 3 of the License, or (at your
|
||||
; * option) any later version.
|
||||
; *
|
||||
; * This program is distributed in the hope that it will be useful, but
|
||||
; * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
; * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
; * License for more details.
|
||||
; *
|
||||
; * You should have received a copy of the GNU Lesser General Public License
|
||||
; * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
; *
|
||||
; * WinDivert is free software; you can redistribute it and/or modify it under
|
||||
; * the terms of the GNU General Public License as published by the Free
|
||||
; * Software Foundation; either version 2 of the License, or (at your option)
|
||||
; * any later version.
|
||||
; *
|
||||
; * This program is distributed in the hope that it will be useful, but
|
||||
; * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
; * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
; * for more details.
|
||||
; *
|
||||
; * You should have received a copy of the GNU General Public License along
|
||||
; * with this program; if not, write to the Free Software Foundation, Inc., 51
|
||||
; * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
; */
|
||||
|
||||
MessageIdTypedef=NTSTATUS
|
||||
|
||||
SeverityNames = (
|
||||
Success = 0x0:STATUS_SEVERITY_SUCCESS
|
||||
Informational = 0x1:STATUS_SEVERITY_INFORMATIONAL
|
||||
Warning = 0x2:STATUS_SEVERITY_WARNING
|
||||
Error = 0x3:STATUS_SEVERITY_ERROR
|
||||
)
|
||||
|
||||
FacilityNames = (
|
||||
System = 0x0:FACILITY_SYSTEM
|
||||
Runtime = 0x2:FACILITY_RUNTIME
|
||||
Stubs = 0x3:FACILITY_STUBS
|
||||
Io = 0x4:FACILITY_IO_ERROR_CODE
|
||||
WinDivert = 0x574:FACILITY_WINDIVERT
|
||||
)
|
||||
|
||||
MessageId=0x312D
|
||||
Facility=WinDivert
|
||||
Severity=Informational
|
||||
SymbolicName=WINDIVERT_INFO_EVENT
|
||||
Language=English
|
||||
%2 %3 (processId=%4)
|
||||
.
|
||||
|
||||
+103
-12
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* test.c
|
||||
* (C) 2019, all rights reserved,
|
||||
* (C) 2021, all rights reserved,
|
||||
*
|
||||
* This file is part of WinDivert.
|
||||
*
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "windivert.h"
|
||||
|
||||
#define MAX_PACKET 2048
|
||||
#define MIN(a, b) ((a) < (b)? (a): (b))
|
||||
|
||||
/*
|
||||
* Packet data.
|
||||
@@ -112,6 +113,30 @@ static const struct packet pkt_ipv6_exthdrs_udp =
|
||||
sizeof(ipv6_exthdrs_udp),
|
||||
"ipv6_exthdrs_udp"
|
||||
};
|
||||
static const struct packet pkt_ipv4_fragment_0 =
|
||||
{
|
||||
ipv4_fragment_0,
|
||||
sizeof(ipv4_fragment_0),
|
||||
"ipv4_fragemnt_0"
|
||||
};
|
||||
static const struct packet pkt_ipv4_fragment_1 =
|
||||
{
|
||||
ipv4_fragment_1,
|
||||
sizeof(ipv4_fragment_1),
|
||||
"ipv4_fragment_1"
|
||||
};
|
||||
static const struct packet pkt_ipv6_fragment_0 =
|
||||
{
|
||||
ipv6_fragment_0,
|
||||
sizeof(ipv6_fragment_0),
|
||||
"ipv6_fragment_0"
|
||||
};
|
||||
static const struct packet pkt_ipv6_fragment_1 =
|
||||
{
|
||||
ipv6_fragment_1,
|
||||
sizeof(ipv6_fragment_1),
|
||||
"ipv6_fragment_1"
|
||||
};
|
||||
static const struct test tests[] =
|
||||
{
|
||||
{"event = PACKET", &pkt_echo_request, TRUE},
|
||||
@@ -167,6 +192,7 @@ static const struct test tests[] =
|
||||
&pkt_echo_request, TRUE},
|
||||
{"(tcp? tcp.DstPort == 80: true) and (udp? udp.DstPort == 80: true)",
|
||||
&pkt_echo_request, TRUE},
|
||||
{"fragment", &pkt_echo_request, FALSE},
|
||||
{"ip and ip and ip and ip and ip and " // Max filter length:
|
||||
"ip and ip and ip and ip and ip and "
|
||||
"ip and ip and ip and ip and ip and "
|
||||
@@ -309,6 +335,9 @@ static const struct test tests[] =
|
||||
{"localAddr == 10.0.0.1 && remoteAddr == 8.8.8.8 && localPort == 8 && "
|
||||
"remotePort == 0 && protocol == 1", &pkt_echo_request, TRUE},
|
||||
{"packet[0] == 0x45", &pkt_echo_request, TRUE},
|
||||
{"ip.MF or ip.FragOff != 0", &pkt_echo_request, FALSE},
|
||||
{"icmp.Body != 123 || icmp.Body == 123", &pkt_echo_request, TRUE},
|
||||
{"length == 84 && ip.Length == 84", &pkt_echo_request, TRUE},
|
||||
{"tcp", &pkt_http_request, TRUE},
|
||||
{"protocol == TCP", &pkt_http_request, TRUE},
|
||||
{"outbound and tcp and tcp.DstPort == 80", &pkt_http_request, TRUE},
|
||||
@@ -603,6 +632,7 @@ static const struct test tests[] =
|
||||
{"localAddr == 10.0.0.1 && remoteAddr == 8.8.4.4 && "
|
||||
"localPort == 57413 && remotePort == 53 && protocol == 17",
|
||||
&pkt_dns_request, TRUE},
|
||||
{"ipv6.DstAddr >= ::", &pkt_dns_request, FALSE},
|
||||
{"ipv6", &pkt_ipv6_tcp_syn, TRUE},
|
||||
{"ip", &pkt_ipv6_tcp_syn, FALSE},
|
||||
{"tcp.Syn", &pkt_ipv6_tcp_syn, TRUE},
|
||||
@@ -720,9 +750,11 @@ static const struct test tests[] =
|
||||
{"icmpv6.Body == 0x10720003", &pkt_ipv6_echo_reply, TRUE},
|
||||
{"ipv6.DstAddr >= 1000", &pkt_ipv6_echo_reply, FALSE},
|
||||
{"ipv6.DstAddr <= 1", &pkt_ipv6_echo_reply, TRUE},
|
||||
{"length == 104 && ipv6.Length == 64", &pkt_ipv6_echo_reply, TRUE},
|
||||
{"ip and !loopback and (outbound? tcp.DstPort == 80 or"
|
||||
" tcp.DstPort == 443 or udp.DstPort == 53 :"
|
||||
" icmp.Type == 11 and icmp.Code == 0)", &pkt_ipv6_echo_reply, FALSE},
|
||||
{"fragment", &pkt_ipv6_echo_reply, FALSE},
|
||||
{"random8 < 128", &pkt_ipv6_echo_reply, TRUE},
|
||||
{"(random8 < 128? random16 < 0x8000: random32 < 0x80000000)",
|
||||
&pkt_ipv6_echo_reply, TRUE},
|
||||
@@ -784,6 +816,7 @@ static const struct test tests[] =
|
||||
{"ipv6.SrcAddr != abcd::1", &pkt_ipv6_exthdrs_udp, TRUE},
|
||||
{"ipv6.SrcAddr >= abcd::1", &pkt_ipv6_exthdrs_udp, FALSE},
|
||||
{"ipv6.SrcAddr > abcd::1", &pkt_ipv6_exthdrs_udp, FALSE},
|
||||
{"ipv6.DstAddr >= ::", &pkt_ipv6_exthdrs_udp, TRUE},
|
||||
{"timestamp > -1", &pkt_ipv6_exthdrs_udp, TRUE},
|
||||
{"udp.SrcPort == 4660 and udp.DstPort == 43690",
|
||||
&pkt_ipv6_exthdrs_udp, TRUE},
|
||||
@@ -855,12 +888,51 @@ static const struct test tests[] =
|
||||
&pkt_ipv6_exthdrs_udp, FALSE},
|
||||
{"localAddr == ::1 and remoteAddr == 1 and localPort == 4660 and "
|
||||
"remotePort == 43690 and protocol == 17", &pkt_ipv6_exthdrs_udp, TRUE},
|
||||
{"fragment", &pkt_ipv4_fragment_0, TRUE},
|
||||
{"ip.MF or ip.FragOff != 0", &pkt_ipv4_fragment_0, TRUE},
|
||||
{"icmp", &pkt_ipv4_fragment_0, TRUE},
|
||||
{"icmp.Body != 123 || icmp.Body == 123", &pkt_ipv4_fragment_0, TRUE},
|
||||
{"length == 84 || ip.Length == 84", &pkt_ipv4_fragment_0, FALSE},
|
||||
{"ip.HdrLength == 5 and ip.TOS == 0 and ip.Length == 28 and "
|
||||
"ip.Id == 0x1234 and ip.FragOff == 0 and ip.MF == 1 and ip.DF == 0 and "
|
||||
"ip.TTL == 64 and ip.Protocol == 1 and ip.SrcAddr == 0xFFFF0A000001 and "
|
||||
"ip.DstAddr == 0xFFFF08080808 and icmp.Type == 8 and icmp.Code == 0 and "
|
||||
"icmp.Body == 0x0D560001", &pkt_ipv4_fragment_0, TRUE},
|
||||
{"fragment", &pkt_ipv4_fragment_1, TRUE},
|
||||
{"ip.MF or ip.FragOff != 0", &pkt_ipv4_fragment_1, TRUE},
|
||||
{"icmp", &pkt_ipv4_fragment_1, FALSE},
|
||||
{"icmp.Body != 123 || icmp.Body == 123", &pkt_ipv4_fragment_1, FALSE},
|
||||
{"length == 84 || ip.Length == 84", &pkt_ipv4_fragment_1, FALSE},
|
||||
{"ip.HdrLength == 5 and ip.TOS == 0 and ip.Length == 76 and "
|
||||
"ip.Id == 0x1234 and ip.FragOff == 1 and ip.MF == 0 and ip.DF == 0 and "
|
||||
"ip.TTL == 64 and ip.Protocol == 1 and ip.SrcAddr == 0xFFFF0A000001 and "
|
||||
"ip.DstAddr == 0xFFFF08080808", &pkt_ipv4_fragment_1, TRUE},
|
||||
{"fragment", &pkt_ipv6_fragment_0, TRUE},
|
||||
{"icmpv6", &pkt_ipv6_fragment_0, TRUE},
|
||||
{"length == 104 || ipv6.Length == 64", &pkt_ipv6_fragment_0, FALSE},
|
||||
{"ipv6.TrafficClass == 0x00000000 and ipv6.FlowLabel == 0x0000 and "
|
||||
"ipv6.Length == 32 and ipv6.NextHdr == 44 and ipv6.HopLimit == 31 and "
|
||||
"ipv6.SrcAddr == 0:0:0:0:0:0:0:1 and ipv6.DstAddr == 0:0:0:0:0:0:0:1 and "
|
||||
"icmpv6.Type == 129 and icmpv6.Code == 0 and icmpv6.Body == 0x10720003",
|
||||
&pkt_ipv6_fragment_0, TRUE},
|
||||
{"fragment", &pkt_ipv6_fragment_1, TRUE},
|
||||
{"icmpv6", &pkt_ipv6_fragment_1, FALSE},
|
||||
{"length == 104 || ipv6.Length == 64", &pkt_ipv6_fragment_1, FALSE},
|
||||
{"ipv6.TrafficClass == 0x00000000 and ipv6.FlowLabel == 0x0000 and "
|
||||
"ipv6.Length == 48 and ipv6.NextHdr == 44 and ipv6.HopLimit == 31 and "
|
||||
"ipv6.SrcAddr == 0:0:0:0:0:0:0:1 and ipv6.DstAddr == 0:0:0:0:0:0:0:1",
|
||||
&pkt_ipv6_fragment_1, TRUE},
|
||||
};
|
||||
|
||||
/*
|
||||
* Test range.
|
||||
*/
|
||||
static size_t lo = 0, hi = UINT_MAX;
|
||||
|
||||
/*
|
||||
* Main.
|
||||
*/
|
||||
int main(void)
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
HANDLE upper_handle, lower_handle;
|
||||
HANDLE console, monitor;
|
||||
@@ -869,6 +941,25 @@ int main(void)
|
||||
LARGE_INTEGER freq;
|
||||
UINT64 diff;
|
||||
size_t i;
|
||||
size_t num_tests = sizeof(tests) / sizeof(struct test), passed_tests;
|
||||
|
||||
switch (argc)
|
||||
{
|
||||
case 1:
|
||||
break;
|
||||
case 3:
|
||||
lo = atoi(argv[1]);
|
||||
hi = atoi(argv[2]);
|
||||
if (hi >= lo)
|
||||
{
|
||||
break;
|
||||
}
|
||||
// Fallthrough
|
||||
default:
|
||||
fprintf(stderr, "usage: %s [low high]\n", argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
hi = MIN(num_tests, hi);
|
||||
|
||||
// Open handles to:
|
||||
// (1) stop normal traffic from interacting with the tests; and
|
||||
@@ -902,8 +993,8 @@ int main(void)
|
||||
Sleep(150);
|
||||
|
||||
// Run tests:
|
||||
size_t num_tests = sizeof(tests) / sizeof(struct test), passed_tests = 0;
|
||||
for (i = 0; i < num_tests; i++)
|
||||
passed_tests = 0;
|
||||
for (i = lo; i < num_tests && i <= hi; i++)
|
||||
{
|
||||
const char *filter = tests[i].filter;
|
||||
const char *packet = tests[i].packet->packet;
|
||||
@@ -915,7 +1006,7 @@ int main(void)
|
||||
passed[i] = run_test(upper_handle, filter, packet, packet_len, match,
|
||||
&diff);
|
||||
diff = 1000000 * diff / freq.QuadPart;
|
||||
printf("%.3u ", i);
|
||||
printf("%.3u ", (unsigned)i);
|
||||
if (passed[i])
|
||||
{
|
||||
SetConsoleTextAttribute(console, FOREGROUND_GREEN);
|
||||
@@ -961,10 +1052,10 @@ int main(void)
|
||||
}
|
||||
|
||||
printf("\npassed = %.2f%%\n",
|
||||
((double)passed_tests / (double)num_tests) * 100.0);
|
||||
((double)passed_tests / (double)(hi - lo)) * 100.0);
|
||||
|
||||
first = TRUE;
|
||||
for (i = 0; i < num_tests; i++)
|
||||
for (i = lo; i < num_tests && i <= hi; i++)
|
||||
{
|
||||
const char *filter = tests[i].filter;
|
||||
char *name = tests[i].packet->name;
|
||||
@@ -982,7 +1073,7 @@ int main(void)
|
||||
printf("\n------------\n\n");
|
||||
first = FALSE;
|
||||
}
|
||||
printf("%.3u ", i);
|
||||
printf("%.3u ", (unsigned)i);
|
||||
SetConsoleTextAttribute(console, FOREGROUND_RED);
|
||||
printf("FAILED");
|
||||
SetConsoleTextAttribute(console, FOREGROUND_RED | FOREGROUND_GREEN |
|
||||
@@ -1153,7 +1244,7 @@ static BOOL run_test(HANDLE inject_handle, const char *filter,
|
||||
if (buf_len[idx] != packet_len)
|
||||
{
|
||||
fprintf(stderr, "error: packet length mis-match, expected (%u), got "
|
||||
"(%u)\n", packet_len, buf_len[idx]);
|
||||
"(%u)\n", (unsigned)packet_len, buf_len[idx]);
|
||||
goto failed;
|
||||
}
|
||||
iphdr = (PWINDIVERT_IPHDR)buf[idx];
|
||||
@@ -1274,7 +1365,7 @@ static DWORD monitor_worker(LPVOID arg)
|
||||
}
|
||||
|
||||
size_t num_tests = sizeof(tests) / sizeof(struct test);
|
||||
for (i = 0; i < num_tests; i++)
|
||||
for (i = lo; i < num_tests && i <= hi; i++)
|
||||
{
|
||||
// (1) Read the reflected filter:
|
||||
WinDivertHelperCompileFilter(tests[i].filter, WINDIVERT_LAYER_NETWORK,
|
||||
@@ -1329,8 +1420,8 @@ static DWORD monitor_worker(LPVOID arg)
|
||||
tests[i].packet->packet_len, &addr) != tests[i].match)
|
||||
{
|
||||
fprintf(stderr, "error: failed to match recompiled filter "
|
||||
"(test = %.3u, filter = \"%s\", err = %d)\n", i,
|
||||
tests[i].filter, GetLastError());
|
||||
"(test = %.3u, filter = \"%s\" formatted = \"%s\", "
|
||||
"err = %d)\n", i, tests[i].filter, filter_2, GetLastError());
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
|
||||
test.vcxproj
|
||||
(C) 2019, all rights reserved,
|
||||
|
||||
This file is part of WinDivert.
|
||||
|
||||
WinDivert is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU Lesser General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
WinDivert is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 2 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc., 51
|
||||
Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
-->
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="test.c">
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||
<AdditionalIncludeDirectories>..\include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<RootNamespace>test</RootNamespace>
|
||||
<ProjectName>test</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ItemDefinitionGroup>
|
||||
<Link>
|
||||
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\install\MSVC\i386\WinDivert.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\install\MSVC\amd64\WinDivert.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
</Project>
|
||||
@@ -181,3 +181,56 @@ static const unsigned char ipv6_exthdrs_udp[] =
|
||||
0x72, 0x6c, 0x64, 0x21, 0x01
|
||||
};
|
||||
|
||||
// IPV4 FRAGMENT #0
|
||||
static const unsigned char ipv4_fragment_0[] =
|
||||
{
|
||||
0x45, 0x00, 0x00, 0x1C, 0x12, 0x34, 0x20, 0x00,
|
||||
0x40, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x01,
|
||||
0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x3c, 0xd2,
|
||||
0x0d, 0x56, 0x00, 0x01
|
||||
};
|
||||
|
||||
// IPV4 FRAGMENT #1
|
||||
static const unsigned char ipv4_fragment_1[] =
|
||||
{
|
||||
0x45, 0x00, 0x00, 0x4C, 0x12, 0x34, 0x00, 0x01,
|
||||
0x40, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x01,
|
||||
0x08, 0x08, 0x08, 0x08, 0x8b, 0xa6, 0x60, 0x54,
|
||||
0x00, 0x00, 0x00, 0x00, 0xf9, 0x08, 0x0a, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x10, 0x11, 0x12, 0x13,
|
||||
0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b,
|
||||
0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23,
|
||||
0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b,
|
||||
0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33,
|
||||
0x34, 0x35, 0x36, 0x37
|
||||
};
|
||||
|
||||
// IPV6 FRAGMENT #0
|
||||
static const unsigned char ipv6_fragment_0[] =
|
||||
{
|
||||
0x60, 0x00, 0x00, 0x00, 0x00, 0x20, 0x2c, 0x1f,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
|
||||
0x3a, 0x00, 0x00, 0x01, 0xc7, 0xf6, 0xce, 0x53,
|
||||
0x81, 0x00, 0x6e, 0xd6, 0x10, 0x72, 0x00, 0x03,
|
||||
0xa4, 0xd5, 0x69, 0x54, 0x00, 0x00, 0x00, 0x00,
|
||||
0xab, 0x75, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
// IPV6 FRAGMENT #1
|
||||
static const unsigned char ipv6_fragment_1[] =
|
||||
{
|
||||
0x60, 0x00, 0x00, 0x00, 0x00, 0x30, 0x2c, 0x1f,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
|
||||
0x3a, 0x00, 0x00, 0x18, 0xc7, 0xf6, 0xce, 0x53,
|
||||
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
|
||||
0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff,
|
||||
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
|
||||
0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff,
|
||||
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user