Note: The default ITS GitLab runner is a shared resource and is subject to slowdowns during heavy usage.
You can run your own GitLab runner that is dedicated just to your group if you need to avoid processing delays.

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

Update crypto_challenge_1/, crypto_challenge_1/flag.txt,...

Update crypto_challenge_1/, crypto_challenge_1/flag.txt, crypto_challenge_1/challenge.txt, crypto_challenge_1/solution.txt files
parent 24618408
# 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!"
Markdown is supported
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