Commit 07fdcbea authored by Brett N Miller's avatar Brett N Miller
Browse files

Update makechallenge.sh, flag.txt, challenge.txt files

parent 14cc866d
BFd31gSW7jaZhnk0a0W3ZL+3BuQh1hmm+UXOl76nRgWwVGF31EMYRLgldeaEFSd2vTb7h/mEGDaFh6lWbyPFpg10yCeTtHc38mfpB9gnt2cnpKATK5a7d7EDeGY0N19z81VQVHiFqJWE083XlKA=
umichCTF{NmjTyzPEw4DRnQgcxHcxe2jGrKsvprvJ1iw0fs7UEXY=}
# Make challenge
# Create a flag file, then a file of random bytes of the same length
flag="umichCTF{"$(openssl rand -base64 32)"}"
echo $flag > flag.txt
filesize=$(wc -c < flag.txt)
openssl rand -out src-file_rand.bin $filesize
# Do a hex dump of the random file, a hex dump of the flag file (in reverse)
# and combine into one file
xxd -p -c1 src-file_rand.bin > tmp1
xxd -p -c1 flag.txt | rev > tmp2
paste -d "\n" tmp1 tmp2 > tmp3
# Base64 it for upload as a challenge
xxd -r -p tmp3 | base64 > challenge.txt
# Clean up
rm tmp1 tmp2 tmp3 src-file_rand.bin
# Check solution
base64 --decode challenge.txt > challenge-txt.bin
xxd -p -c 2 challenge-txt.bin | cut -b 3-4 | rev | xxd -r -p > solution.txt
rm challenge-txt.bin
if ! cmp -s "flag.txt" "solution.txt"; then
echo "Something went wrong - the flag file and solution do not match!"
fi
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment