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 321612e3 authored by Brett N Miller's avatar Brett N Miller
Browse files

Update crypto_challenge_2/makechallenge.sh, crypto_challenge_2/challenge.txt,...

Update crypto_challenge_2/makechallenge.sh, crypto_challenge_2/challenge.txt, crypto_challenge_2/flag.txt files
parent 2334fcdd
746F6A676D45534E723B4F686B615E63675975715D614E707271766A5E765E1D1C5F
\ No newline at end of file
umichCTF{1DdfoQsvKfeHwYhkkmvChA==}
\ No newline at end of file
# Make challenge
# Encrypte a file with a simple XOR, with the key being integers starting at 1.
#
flag="umichCTF{"$(openssl rand -base64 16)"}"
echo -n $flag > flag.txt
filesize=$(wc -c < flag.txt)
# Make the key file - just hex numbers increasing from 1, one per line.
jot -w "%x" $filesize 1 $filesize > key.txt
# Make file to create xor printf lines to execute in bash. Use "#" in paste for ease of replacement in sed.
xxd -p -c1 flag.txt > flag-lines-hex.txt
paste -d "#" flag-lines-hex.txt key.txt > xors.txt
cat xors.txt | sed -e "s/^/printf '\%X' \$\(\(0x/" | sed -e "s/#/\^0x/" | sed -e "s/$/\)\)/" | bash > challenge.txt
rm flag-lines-hex.txt xors.txt
# Check the encryption/decryption
xxd -r -p challenge.txt | xxd -p -c1 > crypto-lines.txt
paste -d "#" crypto-lines.txt key.txt > xors2.txt
cat xors2.txt | sed -e "s/^/printf '\%X' \$\(\(0x/" | sed -e "s/#/\^0x/" | sed -e "s/$/\)\)/" | bash > unxored.txt
xxd -r -p unxored.txt > decrypted.txt
if ! cmp -s "flag.txt" "decrypted.txt"; then
echo "Something went wrong - the flag file and solution do not match!"
fi
# Cleanup
rm crypto-lines.txt xors2.txt unxored.txt decrypted.txt key.txt
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