From d472f9682f6b3b908d0effefe5d7a1a8f5576017 Mon Sep 17 00:00:00 2001 From: fred Date: Wed, 1 Mar 2023 00:23:36 +0100 Subject: [PATCH] 45780 45781 PORT SWAPING --- 12345.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/12345.sh b/12345.sh index f17f23ef..7359e5ef 100755 --- a/12345.sh +++ b/12345.sh @@ -65,10 +65,11 @@ while true; do # EACH VISITOR RECEIVE COMMAND RESPONSE ON ## RANDOM PORT = RESPONSE SOCKET & IPNS SESSION TOKEN - - [ ${PORT} -le 12345 ] && PORT=$((PORT+${RANDOM:0:2})) || PORT=$((PORT-${RANDOM:0:2})) - [[ ${isLAN} && $(which yunohost) ]] && PORT=$((PORT+1)) && [ ${PORT} -ge 45782 ] && PORT=45780 ## yunohost OPEN FIREWALL 1234 12345 45780 45781 - ## RANDOM PORT SWAPPINESS AVOIDING COLLISION + [[ ${isLAN} && $(which yunohost) ]]; then + PORT=$((PORT+1)) && [ ${PORT} -ge 45782 ] && PORT=45780 ## yunohost OPEN FIREWALL 1234 12345 45780 45781 + else + [ ${PORT} -le 12345 ] && PORT=$((PORT+${RANDOM:0:2})) || PORT=$((PORT-${RANDOM:0:2})) + fi ## RANDOM PORT SWAPPINESS AVOIDING COLLISION ## CHECK PORT IS FREE & KILL OLD ONE pidportinuse=$(ps axf --sort=+utime | grep -w "nc -l -p ${PORT}" | grep -v -E 'color=auto|grep' | awk '{gsub(/^ +| +$/,"")} {print $0}' | tail -n 1 | cut -d " " -f 1)