no trigger session check if session no correctly established

This commit is contained in:
localhost_frssoft 2023-07-24 13:17:18 +03:00
parent 6cd060681e
commit 870461bf7a

View File

@ -14,6 +14,7 @@ mkdir -p -m 700 access_denied
if [ -f access_denied/"$remote_ip" ]; then exit 0; fi if [ -f access_denied/"$remote_ip" ]; then exit 0; fi
. ./mastodon_api.sh . ./mastodon_api.sh
session_established=0
generator_session=$(zcat -f $system_dict | shuf -n 2 | tr -d "\n'") generator_session=$(zcat -f $system_dict | shuf -n 2 | tr -d "\n'")
randpadding=$(head -c 8 /dev/urandom | base64) randpadding=$(head -c 8 /dev/urandom | base64)
printf "$randpadding\t$generator_session\n" printf "$randpadding\t$generator_session\n"
@ -24,11 +25,14 @@ while read -r cmd mesg; do
session=$(echo "$mesg" | cut -d' ' -f 1) session=$(echo "$mesg" | cut -d' ' -f 1)
if [ "$session" = "$generator_session" ] && [ "$key" = "$pass_for_bbs" ]; then if [ "$session" = "$generator_session" ] && [ "$key" = "$pass_for_bbs" ]; then
echo "$generator_session" > access_granted/"$remote_ip" echo "$generator_session" > access_granted/"$remote_ip"
session_established=1
echo hi $remote_ip echo hi $remote_ip
else else
die die
break break
fi fi
else
if [ "$session_established" -eq 0 ]; then die; break; fi
fi fi
if [ ! -n "$(grep -F "$generator_session" access_granted/"$remote_ip")" ]; then # Drop unregistred handshake if [ ! -n "$(grep -F "$generator_session" access_granted/"$remote_ip")" ]; then # Drop unregistred handshake
die die