From 71823459a70ed529859e0d005cd97058191654c3 Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Sat, 5 Apr 2025 13:32:58 +0200 Subject: [PATCH] fix(CheckProxy): refine port conflict detection with improved grep patterns --- app/Actions/Proxy/CheckProxy.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Actions/Proxy/CheckProxy.php b/app/Actions/Proxy/CheckProxy.php index 5d3ce745b..cb146073e 100644 --- a/app/Actions/Proxy/CheckProxy.php +++ b/app/Actions/Proxy/CheckProxy.php @@ -144,7 +144,7 @@ class CheckProxy // Get listening process details "ss_output=\$(ss -tuln state listening sport = :$port 2>/dev/null) && echo \"\$ss_output\"", // Count IPv4 listeners - "echo \"\$ss_output\" | grep -c 'LISTEN.*:$port'", + "echo \"\$ss_output\" | grep -c ':$port '", ], ], // Set 2: Use netstat as alternative to ss @@ -154,7 +154,7 @@ class CheckProxy // Get listening process details "netstat_output=\$(netstat -tuln 2>/dev/null) && echo \"\$netstat_output\" | grep ':$port '", // Count listeners - "echo \"\$netstat_output\" | grep ':$port' | grep -c 'LISTEN'", + "echo \"\$netstat_output\" | grep ':$port ' | grep -c 'LISTEN'", ], ], // Set 3: Use lsof as last resort