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