Commit cda61e2a authored by Brett N Miller's avatar Brett N Miller
Browse files

Update crypto_challenge_1/makechallenge.sh, crypto_challenge_1/flag.txt,...

Update crypto_challenge_1/makechallenge.sh, crypto_challenge_1/flag.txt, crypto_challenge_1/challenge.txt, crypto_challenge_1/solution.txt files
parent 24618408
PFem1muWtjYXhiQ26kcrZkK3BiMttNA1UxO8c/11mjNTZ/8VADfmRDJG4ubc1vODByceNaXGpaWDpBoHEVfrJK8DRBX+Fask5DZfFZxzXBeY1hRWi2c4FqSDZTNMM2QUEDetJYQzsbZ606HXDqA=
umichctf{2KS17W3vQsDdnm8rSlZJpuB0QQBcQ7qmeva833AsR3k=}
# 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
umichctf{2KS17W3vQsDdnm8rSlZJpuB0QQBcQ7qmeva833AsR3k=}
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