45780 45781 PORT SWAPING
This commit is contained in:
parent
8865ab418d
commit
d472f9682f
9
12345.sh
9
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)
|
||||
|
|
Loading…
Reference in New Issue