From fac316780bf831f1c0e4e971da785b79f5c40206 Mon Sep 17 00:00:00 2001 From: Connection Refused Date: Mon, 4 Oct 2021 22:15:04 +0800 Subject: [PATCH] [Redirector] Bypass self force --- Redirector/EventHandler.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Redirector/EventHandler.cpp b/Redirector/EventHandler.cpp index b5d19a3e..d78721f8 100644 --- a/Redirector/EventHandler.cpp +++ b/Redirector/EventHandler.cpp @@ -13,6 +13,8 @@ extern vector handleList; extern USHORT tcpListen; +DWORD CurrentID = 0; + mutex udpContextLock; map udpContext; @@ -137,6 +139,8 @@ bool checkHandleName(DWORD id) bool eh_init() { + CurrentID = GetCurrentProcessId(); + if (!DNSHandler::Init()) { return false; @@ -165,6 +169,12 @@ void threadEnd() void tcpConnectRequest(ENDPOINT_ID id, PNF_TCP_CONN_INFO info) { + if (CurrentID == info->processId) + { + nf_tcpDisableFiltering(id); + return; + } + if (!filterTCP) { nf_tcpDisableFiltering(id); @@ -263,6 +273,12 @@ void tcpClosed(ENDPOINT_ID id, PNF_TCP_CONN_INFO info) void udpCreated(ENDPOINT_ID id, PNF_UDP_CONN_INFO info) { + if (CurrentID == info->processId) + { + nf_udpDisableFiltering(id); + return; + } + if (!filterUDP) { wcout << "[Redirector][EventHandler][udpCreated][" << id << "][" << info->processId << "][!filterUDP] " << GetProcessName(info->processId) << endl;