sbs5@lion:~/cs200/www/lectures$ date Wed Dec 3 02:29:35 PM EST 2025 sbs5@lion:~/cs200/www/lectures$ pwd /home/accts/sbs5/cs200/www/lectures sbs5@lion:~/cs200/www/lectures$ cd /c/cs2000/hws sbs5@lion:/c/cs2000/hws$ ls hw0a.pyc hw1.py hw3a.pyc hw4a.pyc hw5.py hw7 hw0.py hw2a.pyc hw3match.py hw4.py hw6a.pyc __pycache__ hw1a.pyc hw2.py hw3.py hw5a.pyc hw6.py sbs5@lion:/c/cs2000/hws$ cd hw7 sbs5@lion:/c/cs2000/hws/hw7$ ls decode.pyc encode.sh poem1 poem2 poem5 decode.sh hw7.py poem1.3.out poem3 poem5.2.out encode.pyc password poem1.3.out.3 poem4 poem5.2.out.2 sbs5@lion:/c/cs2000/hws/hw7$ cat encode.sh #! /usr/bin/bash echo if no args, print usage and exit echo ARGS: $* echo loop through args echo "for each arg (file) try to encode it with one of the following:" echo Use the openssl command with the "enc -e " options echo aes-128-cbc aes-128-ecb des des3 des-cbc rc5 idea echo select the code at random, using \$RANDOM echo use "r.out" as the suffix for the output file where r is the random index echo 'Note: the file "password" contains the password (YELLOW SUBMARINE)' arr=(aes-128-cbc aes-128-ecb des3 aria-128-ecb aria-192-ecb aes-256-ecb aes-256-cbc) n=7 sbs5@lion:/c/cs2000/hws/hw7$ ls decode.pyc encode.sh poem1 poem2 poem5 decode.sh hw7.py poem1.3.out poem3 poem5.2.out encode.pyc password poem1.3.out.3 poem4 poem5.2.out.2 sbs5@lion:/c/cs2000/hws/hw7$ cat password YELLOW SUBMARINEsbs5@lion:/c/cs2000/hws/hw7$ openssl --help help: Standard commands asn1parse ca ciphers cmp cms crl crl2pkcs7 dgst dhparam dsa dsaparam ec ecparam enc engine errstr fipsinstall gendsa genpkey genrsa help info kdf list mac nseq ocsp passwd pkcs12 pkcs7 pkcs8 pkey pkeyparam pkeyutl prime rand rehash req rsa rsautl s_client s_server s_time sess_id smime speed spkac srp storeutl ts verify version x509 Message Digest commands (see the `dgst' command for more details) blake2b512 blake2s256 md4 md5 rmd160 sha1 sha224 sha256 sha3-224 sha3-256 sha3-384 sha3-512 sha384 sha512 sha512-224 sha512-256 shake128 shake256 sm3 Cipher commands (see the `enc' command for more details) aes-128-cbc aes-128-ecb aes-192-cbc aes-192-ecb aes-256-cbc aes-256-ecb aria-128-cbc aria-128-cfb aria-128-cfb1 aria-128-cfb8 aria-128-ctr aria-128-ecb aria-128-ofb aria-192-cbc aria-192-cfb aria-192-cfb1 aria-192-cfb8 aria-192-ctr aria-192-ecb aria-192-ofb aria-256-cbc aria-256-cfb aria-256-cfb1 aria-256-cfb8 aria-256-ctr aria-256-ecb aria-256-ofb base64 bf bf-cbc bf-cfb bf-ecb bf-ofb camellia-128-cbc camellia-128-ecb camellia-192-cbc camellia-192-ecb camellia-256-cbc camellia-256-ecb cast cast-cbc cast5-cbc cast5-cfb cast5-ecb cast5-ofb des des-cbc des-cfb des-ecb des-ede des-ede-cbc des-ede-cfb des-ede-ofb des-ede3 des-ede3-cbc des-ede3-cfb des-ede3-ofb des-ofb des3 desx rc2 rc2-40-cbc rc2-64-cbc rc2-cbc rc2-cfb rc2-ecb rc2-ofb rc4 rc4-40 seed seed-cbc seed-cfb seed-ecb seed-ofb sm4-cbc sm4-cfb sm4-ctr sm4-ecb sm4-ofb sbs5@lion:/c/cs2000/hws/hw7$ openssl enc --help Usage: enc [options] General options: -help Display this summary -list List ciphers -ciphers Alias for -list -e Encrypt -d Decrypt -p Print the iv/key -P Print the iv/key and exit -engine val Use engine, possibly a hardware device Input options: -in infile Input file -k val Passphrase -kfile infile Read passphrase from file Output options: -out outfile Output file -pass val Passphrase source -v Verbose output -a Base64 encode/decode, depending on encryption flag -base64 Same as option -a -A Used with -[base64|a] to specify base64 buffer as a single line Encryption options: -nopad Disable standard block padding -salt Use salt in the KDF (default) -nosalt Do not use salt in the KDF -debug Print debug info -bufsize val Buffer size -K val Raw key, in hex -S val Salt, in hex -iv val IV in hex -md val Use specified digest to create a key from the passphrase -iter +int Specify the iteration count and force the use of PBKDF2 Default: 10000 -pbkdf2 Use password-based key derivation function 2 (PBKDF2) Use -iter to change the iteration count from 10000 -none Don't encrypt -* Any supported cipher Random state options: -rand val Load the given file(s) into the random number generator -writerand outfile Write random data to the specified file Provider options: -provider-path val Provider load path (must be before 'provider' argument if required) -provider val Provider to load (can be specified multiple times) -propquery val Property query used when fetching algorithms sbs5@lion:/c/cs2000/hws/hw7$ ls decode.pyc encode.sh poem1 poem2 poem5 decode.sh hw7.py poem1.3.out poem3 poem5.2.out encode.pyc password poem1.3.out.3 poem4 poem5.2.out.2 sbs5@lion:/c/cs2000/hws/hw7$ ./encode.pyc poem4 ARGS: poem4 encoding: poem4 as poem4.3.out (aria-128-ecb) openssl enc -e -aria-128-ecb -in poem4 -out poem4.3.out -pass file:password -base64 *** WARNING : deprecated key derivation used. Using -iter or -pbkdf2 would be better. sbs5@lion:/c/cs2000/hws/hw7$ ls decode.pyc encode.sh poem1 poem2 poem4.3.out poem5.2.out.2 decode.sh hw7.py poem1.3.out poem3 poem5 encode.pyc password poem1.3.out.3 poem4 poem5.2.out sbs5@lion:/c/cs2000/hws/hw7$ cat poem4.3.out U2FsdGVkX1+5wCo1Nba+T/uZEvDRZIkq1AY0mbWRh6RqZdY6rOcSX3u5GoQBs0pb xzDvnIagIK88Ur+dZ4Q7xcss9qLwwW1aAZngbYsrixWPhVA47WJbR7VLjG+cM1QM Ovtw9DS7Ar2naQDEUj2yPk05QZ56C/e3xh8ycUM4DE56IQhv8PLILTHmNxLi6rOi P8lw+HWehChwE0cmCt2ngZgNq6quJdKbn6Ipw3mcY+fccUK+Ekb+K28LYTmXHn5A v7LabSFzOq2srYj1qqUa3b37InHM3aPg5vuKUsSvKH9RU7Qj+YN/+s0ri5THYlHa FJ3cB2qUroT9bgF5XBUOnfLrqUjuHKU0lq63Atcxi7od2RVoeBJ5UbMw/wrhyqtR O7Zd/NYDnZ0Xgkh+zqfOYjRlqFVEzlQqcpaTE3z5XnVGgA46ww5YWXihhjYs5/KM Mfkf4p2NuqHM0UYLrMuuVPG6htZucyCUgJcZokuiVBu+RrqiTv5V0DBmPIxuSpB1 rpq2UhdxEy1/Zgc5d0M2TaIn+RqEt2gtNol7dWmAdwaHBWwcya+28WgjXw8NKLfM UjznCVn4I9JGZz7WyvglftzDl5azbQYulV4r6Y/M0Pg8/Z/Ob05S0Ipc/tfwdYaF bPT85SALZQJpLECl3b2FnjRTf7q/aR3ZaLuhKNngvHAdPNwRHSF8kin1J5ewhswV ABDWiOmY9km62046OguqJEDZ+ndr6nlIj6vZq4hy6vfWcrbKeQ7rbBMrhvrxcTf+ sbs5@lion:/c/cs2000/hws/hw7$ ./decode.pyc poem4.3.out ARGS: poem4.3.out Decoding: poem4.3.out decoding: poem4.3.out as poem4.3.out.0 (aes-128-cbc) openssl enc -d -aes-128-cbc -in poem4.3.out -out poem4.3.out.0 -pass file:password -base64 removing output file: poem4.3.out.0 decoding: poem4.3.out as poem4.3.out.1 (aes-128-ecb) openssl enc -d -aes-128-ecb -in poem4.3.out -out poem4.3.out.1 -pass file:password -base64 removing output file: poem4.3.out.1 decoding: poem4.3.out as poem4.3.out.2 (des3) openssl enc -d -des3 -in poem4.3.out -out poem4.3.out.2 -pass file:password -base64 removing output file: poem4.3.out.2 decoding: poem4.3.out as poem4.3.out.3 (aria-128-ecb) openssl enc -d -aria-128-ecb -in poem4.3.out -out poem4.3.out.3 -pass file:password -base64 saving output file: poem4.3.out.3 decoding: poem4.3.out as poem4.3.out.4 (aria-192-ecb) openssl enc -d -aria-192-ecb -in poem4.3.out -out poem4.3.out.4 -pass file:password -base64 removing output file: poem4.3.out.4 decoding: poem4.3.out as poem4.3.out.5 (aes-256-ecb) openssl enc -d -aes-256-ecb -in poem4.3.out -out poem4.3.out.5 -pass file:password -base64 removing output file: poem4.3.out.5 decoding: poem4.3.out as poem4.3.out.6 (aes-256-cbc)) openssl enc -d -aes-256-cbc) -in poem4.3.out -out poem4.3.out.6 -pass file:password -base64 rm: cannot remove 'poem4.3.out.6': No such file or directory removing output file: poem4.3.out.6 sbs5@lion:/c/cs2000/hws/hw7$ ls decode.pyc encode.sh poem1 poem2 poem4.3.out poem5.2.out decode.sh hw7.py poem1.3.out poem3 poem4.3.out.3 poem5.2.out.2 encode.pyc password poem1.3.out.3 poem4 poem5 sbs5@lion:/c/cs2000/hws/hw7$ diff poem4 poem4.3.out.3 sbs5@lion:/c/cs2000/hws/hw7$ exit Process shell finished