As a fun challenge, there is a bash script that echo's to the screen an encoded output (base64). Every 15 seconds it will change. The goal is to input the decoded base64 value(s) and submit before the 15 seconds are up. Since its bash, you could easily cheat and just change the params or even time delay but my goal would be to leave the bash script alone and write another script using bash or python to catch output and decode the string automatically. Does anyone have an opinion on the best way to do this?
Is there a way to catch the output from this bash script and have it processed by an external script ?
Here is the challenge script:
#!/bin/bash
V_COUNT=0
f_encode(){
V_NUM=$(echo $RANDOM)
V_ENC=$(echo $V_NUM | base64)
f_question
}
f_question(){
V_COUNT=$((V_COUNT+1))
echo '[*] You have 15 seconds to decode this and submit: '$V_ENC
echo ''
read -t 15 -p 'Submit Decoded Key: ' V_DEC
if [ "$V_DEC" = "$V_NUM" ]; then
echo '[*] Congrats, you did it!'
echo 'Attempts: '$V_COUNT
exit 1
else
f_encode
fi
}
f_encode