From 9b4977d62cf0c863269871a2c0f8467df17f0542 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Tue, 26 Dec 2023 06:10:34 -0800 Subject: [PATCH] Improve 2020/ferguson2 try scripts Added key.txt which is based on the judges' try.this.txt file (which was based on something I originally submitted) which only has the key rather than the input. This file is then used by try.sh and try.alt.sh. Pass -v to recode now so that one can see the settings used and in a nice way. --- 2020/ferguson2/key.txt | 1 + 2020/ferguson2/try.alt.sh | 43 ++++++++++++++++++++++++++++----------- 2020/ferguson2/try.sh | 43 ++++++++++++++++++++++++++++----------- thanks-for-help.md | 5 +++++ 4 files changed, 68 insertions(+), 24 deletions(-) create mode 100644 2020/ferguson2/key.txt diff --git a/2020/ferguson2/key.txt b/2020/ferguson2/key.txt new file mode 100644 index 000000000..435b80164 --- /dev/null +++ b/2020/ferguson2/key.txt @@ -0,0 +1 @@ +3IO1CC5CZ2CODESNXYMSATVFURKLBJ diff --git a/2020/ferguson2/try.alt.sh b/2020/ferguson2/try.alt.sh index 2b1fbe45e..31050677e 100755 --- a/2020/ferguson2/try.alt.sh +++ b/2020/ferguson2/try.alt.sh @@ -60,29 +60,48 @@ echo 1>&2 ./prog.alt - < try.this.txt 2>/dev/null echo 1>&2 +# even more input fun: +read -r -n 1 -p "Press any key to show key.txt: " +echo 1>&2 +echo "$ cat key.txt" 1>&2 +cat key.txt +echo 1>&2 +read -r -n 1 -p "Press any key to encrypt IOCCC with code of key.txt: " +echo 1>&2 +echo "$ echo IOCCC | ./recode -v -Rkey.txt | ./prog.alt - 2>/dev/null" 1>&2 +echo IOCCC | ./recode -v -Rkey.txt | ./prog.alt - 2>/dev/null +echo 1>&2 + +# now decrypt IOCCC with settings of key.txt by piping it back to recode -> prog.alt +read -r -n 1 -p "Press any key to encrypt and then decrypt IOCCC with code of key.txt: " +echo 1>&2 +echo "$ echo IOCCC | ./recode -v -Rkey.txt | ./prog - 2>/dev/null | ./recode -Rkey.txt | ./prog.alt - 2>/dev/null" 1>&2 +echo IOCCC | ./recode -v -Rkey.txt | ./prog - 2>/dev/null | ./recode -Rkey.txt | ./prog.alt - 2>/dev/null +echo 1>&2 + # more obfuscated fun: read -r -n 1 -p "Press any key to send 'testing test tests' to recode: " echo 1>&2 -echo "$ echo testing test tests | ./recode" 1>&2 -echo testing test tests | ./recode +echo "$ echo testing test tests | ./recode -v" 1>&2 +echo testing test tests | ./recode -v echo 1>&2 read -r -n 1 -p "Press any key to send 'testing test tests' to recode -> prog.alt: " echo 1>&2 -echo "$ echo testing test tests | ./recode | ./prog.alt - 2>/dev/null" 1>&2 -echo testing test tests | ./recode | ./prog.alt - 2>/dev/null +echo "$ echo testing test tests | ./recode -v | ./prog.alt - 2>/dev/null" 1>&2 +echo testing test tests | ./recode -v | ./prog.alt - 2>/dev/null echo 1>&2 read -r -n 1 -p "Press any key to send 'testing test tests' to recode -> prog -> recode: " echo 1>&2 -echo "$ echo testing test tests | ./recode | ./prog - 2>/dev/null | ./recode" 1>&2 -echo testing test tests | ./recode | ./prog - 2>/dev/null | ./recode +echo "$ echo testing test tests | ./recode -v | ./prog - 2>/dev/null | ./recode" 1>&2 +echo testing test tests | ./recode -v | ./prog - 2>/dev/null | ./recode -v echo 1>&2 read -r -n 1 -p "Press any key to send 'testing test tests' to recode -> prog -> recode -> prog.alt: " echo 1>&2 -echo "$ echo testing test tests | ./recode | ./prog - 2>/dev/null | ./recode | ./prog.alt - 2>/dev/null" 1>&2 -echo testing test tests | ./recode | ./prog - 2>/dev/null | ./recode | ./prog.alt - 2>/dev/null +echo "$ echo testing test tests | ./recode -v | ./prog - 2>/dev/null | ./recode -v | ./prog.alt - 2>/dev/null" 1>&2 +echo testing test tests | ./recode -v | ./prog - 2>/dev/null | ./recode -v | ./prog.alt - 2>/dev/null echo 1>&2 # even more obfuscated fun saving and reading from files: @@ -93,8 +112,8 @@ rm -f conf input output output2 # original string to input and original output to output: read -r -n 1 -p "Press any key to save settings and output, then encrypt: " echo 1>&2 -echo "$ echo testing test tests | tee input | ./recode -r -oconf | ./prog - 2>/dev/null >output" 1>&2 -echo testing test tests | tee input | ./recode -r -oconf | ./prog - 2>/dev/null >output +echo "$ echo testing test tests | tee input | ./recode -v -r -oconf | ./prog - 2>/dev/null >output" 1>&2 +echo testing test tests | tee input | ./recode -v -r -oconf | ./prog - 2>/dev/null >output read -r -n 1 -p "Press any key to show input file: " echo 1>&2 cat input @@ -106,8 +125,8 @@ echo 1>&2 # configure Enigma machine from conf file and read from output file, thus decrypting: read -r -n 1 -p "Press any key to decrypt the output from the above command: " echo 1>&2 -echo "$ ./recode -Rconf -foutput | ./prog - 2>/dev/null > output2" 1>&2 -./recode -Rconf -foutput | ./prog - 2>/dev/null > output2 +echo "$ ./recode -v -Rconf -foutput | ./prog - 2>/dev/null > output2" 1>&2 +./recode -v -Rconf -foutput | ./prog - 2>/dev/null > output2 read -r -n 1 -p "Press any key to show output2: " echo 1>&2 cat output2 diff --git a/2020/ferguson2/try.sh b/2020/ferguson2/try.sh index 2d70f4f2c..22a2f3a96 100755 --- a/2020/ferguson2/try.sh +++ b/2020/ferguson2/try.sh @@ -60,29 +60,48 @@ echo 1>&2 ./prog - < try.this.txt 2>/dev/null echo 1>&2 +# even more input fun: +read -r -n 1 -p "Press any key to show key.txt: " +echo 1>&2 +echo "$ cat key.txt" 1>&2 +cat key.txt +echo 1>&2 +read -r -n 1 -p "Press any key to encrypt IOCCC with code of key.txt: " +echo 1>&2 +echo "$ echo IOCCC | ./recode -v -Rkey.txt | ./prog - 2>/dev/null" 1>&2 +echo IOCCC | ./recode -v -Rkey.txt | ./prog - 2>/dev/null +echo 1>&2 + +# now decrypt IOCCC with settings of key.txt by piping it back to recode -> prog +read -r -n 1 -p "Press any key to encrypt and then decrypt IOCCC with code of key.txt: " +echo 1>&2 +echo "$ echo IOCCC | ./recode -v -Rkey.txt | ./prog - 2>/dev/null | ./recode -Rkey.txt | ./prog - 2>/dev/null" 1>&2 +echo IOCCC | ./recode -v -Rkey.txt | ./prog - 2>/dev/null | ./recode -Rkey.txt | ./prog - 2>/dev/null +echo 1>&2 + # more obfuscated fun: read -r -n 1 -p "Press any key to send 'testing test tests' to recode: " echo 1>&2 -echo "$ echo testing test tests | ./recode" 1>&2 -echo testing test tests | ./recode +echo "$ echo testing test tests | ./recode -v" 1>&2 +echo testing test tests | ./recode -v echo 1>&2 read -r -n 1 -p "Press any key to send 'testing test tests' to recode -> prog: " echo 1>&2 -echo "$ echo testing test tests | ./recode | ./prog - 2>/dev/null" 1>&2 -echo testing test tests | ./recode | ./prog - 2>/dev/null +echo "$ echo testing test tests | ./recode -v | ./prog - 2>/dev/null" 1>&2 +echo testing test tests | ./recode -v | ./prog - 2>/dev/null echo 1>&2 read -r -n 1 -p "Press any key to send 'testing test tests' to recode -> prog -> recode: " echo 1>&2 -echo "$ echo testing test tests | ./recode | ./prog - 2>/dev/null | ./recode" 1>&2 -echo testing test tests | ./recode | ./prog - 2>/dev/null | ./recode +echo "$ echo testing test tests | ./recode -v | ./prog - 2>/dev/null | ./recode" 1>&2 +echo testing test tests | ./recode -v | ./prog - 2>/dev/null | ./recode echo 1>&2 read -r -n 1 -p "Press any key to send 'testing test tests' to recode -> prog -> recode -> prog: " echo 1>&2 -echo "$ echo testing test tests | ./recode | ./prog - 2>/dev/null | ./recode | ./prog - 2>/dev/null" 1>&2 -echo testing test tests | ./recode | ./prog - 2>/dev/null | ./recode | ./prog - 2>/dev/null +echo "$ echo testing test tests | ./recode -v | ./prog - 2>/dev/null | ./recode -v | ./prog - 2>/dev/null" 1>&2 +echo testing test tests | ./recode -v | ./prog - 2>/dev/null | ./recode -v | ./prog - 2>/dev/null echo 1>&2 # even more obfuscated fun saving and reading from files: @@ -93,8 +112,8 @@ rm -f conf input output output2 # original string to input and original output to output: read -r -n 1 -p "Press any key to save settings and output, then encrypt: " echo 1>&2 -echo "$ echo testing test tests | tee input | ./recode -r -oconf | ./prog - 2>/dev/null >output" 1>&2 -echo testing test tests | tee input | ./recode -r -oconf | ./prog - 2>/dev/null >output +echo "$ echo testing test tests | tee input | ./recode -v -r -oconf | ./prog - 2>/dev/null >output" 1>&2 +echo testing test tests | tee input | ./recode -v -r -oconf | ./prog - 2>/dev/null >output read -r -n 1 -p "Press any key to show input file: " echo 1>&2 cat input @@ -106,8 +125,8 @@ echo 1>&2 # configure Enigma machine from conf file and read from output file, thus decrypting: read -r -n 1 -p "Press any key to decrypt the output from the above command: " echo 1>&2 -echo "$ ./recode -Rconf -foutput | ./prog - 2>/dev/null > output2" 1>&2 -./recode -Rconf -foutput | ./prog - 2>/dev/null > output2 +echo "$ ./recode -v -Rconf -foutput | ./prog - 2>/dev/null > output2" 1>&2 +./recode -v -Rconf -foutput | ./prog - 2>/dev/null > output2 read -r -n 1 -p "Press any key to show output2: " echo 1>&2 cat output2 diff --git a/thanks-for-help.md b/thanks-for-help.md index c95fb98a7..2c4759449 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -4413,6 +4413,11 @@ He also added the [try.sh](/2020/ferguson2/try.sh) script. He also added the [alt code](/2020/ferguson2/README.md#alternate-code) and the [try.alt.sh](/2020/ferguson2/try.alt.sh) script. +The try scripts involved the addition of a text file, +[key.txt](/2020/ferguson2/key.txt) which has the key of the file the judges +added in [try.this.txt](/2020/ferguson2/try.this.txt) which itself was based on +something the author (Cody :-) ) submitted in the first place. + He also fixed some issues that occurred when files were renamed to `.md` from `.markdown`.