COP3353 - 2017 Summer
Assignment 6 "The Final Problem"
Due by 11:59pm on Monday, July 31

The Final Problem

First, login to cop3353.org. You should find a new subdirectory in your home directory, called FinalProblem/. Do a cd into this subdirectory.

There are three files in the subdirectory:

COP3353_test@cop3353:~$ cd FinalProblem
COP3353_test@cop3353:~/FinalProblem$ ls -al
total 284
drwxr-xr-x  2 COP3353_test COP3353_test  4096 Jul 26 17:49 .
drwx------ 12 COP3353_test COP3353_test  4096 Jul 26 17:49 ..
-rw-r--r--  1 COP3353_test COP3353_test 92919 Jul 26 17:49 advanced.txt
-rw-r--r--  1 COP3353_test COP3353_test 93090 Jul 26 17:49 basic.txt
-rw-r--r--  1 COP3353_test COP3353_test 92101 Jul 26 17:49 excerpt.txt
COP3353_test@cop3353:~/FinalProblem$ 

The excerpt.txt is an extended excerpt from the classic "Memoirs of Extraordinary Popular Delusions and the Madness of Crowds" by Charles Mackay, about the South Sea Bubble that gripped London in the years from about 1719 to 1720 (amusingly enough, this was pretty much contemporaneous with the Mississippi Bubble in France.)

The other two files are slightly larger because they are slightly modified copies of excerpt.txt.

First, do a sha1sum to verify that the files excerpt.txt, basic.txt, and advanced.txt are all different:

COP3353_test@cop3353:~/FinalProblem$ sha1sum *.txt
53314fad78ead60d28521933c429ec2a474bbefd  advanced.txt
a8a9a4a5d1fc496f7c2a9a149ad326ac4dfd366a  basic.txt
d81342c590e07a41c82d9c669c89067b4f714c6f  excerpt.txt

Then do a side-by-side with "pr -t -w 140 -m excerpt.txt basic.txt" and "pr -t -w 140 -m excerpt.txt advanced.txt":

d81342c590e07a41c82d9c669c89067b4f714c6f  excerpt.txt
COP3353_test@cop3353:~/FinalProblem$ pr -t -w 140 -m excerpt.txt basic.txt 


MEMOIRS                                                               MEMOIRS

OF                                                                    OF

EXTRAORDINARY POPULAR DELUSIONS.                                      EXTRAORDINARY POPULAR DELUSIONS.


[ ... ]                                                               [ ... ]

                                                                                                                                                                            

THE SOUTH-SEA BUBBLE.                                                 THE SOUTH-SEA BUBBLE.

    At length corruption, like a general flood,                           At length corruption, like a general flood,
    Did deluge all; and avarice creeping on,                              Did deluge all; and avarice creeping on,
    Spread, like a low-born mist, and hid the sun.                        Spread, like a low-born mist, and hid the sun.

Finally, try a diff excerpt.txt basic.txt and diff excerpt.txt advanced.txt to try to spot the differences.

So what's going on? These files are different, but the differences seem obscure.

The modifications are related to steganography, the art of hiding messages. The program that I used to create these two files with hidden messages is called stegsnow by Michael Kwan.

To use stegsnow, first take your plaintext and see how much space is available to hide messages:

COP3353_test@cop3353:~/FinalProblem$ stegsnow -S excerpt.txt 
File has storage capacity of between 12212 and 15731 bits.
Approximately 1746 bytes.

Now view the hidden message in basic.txt:

COP3353_test@cop3353:~/FinalProblem$ stegsnow -C basic.txt
312b539b-3c7a-4415-aba0-78b14e2512fc

Hello, COP3353_test!

This is a hidden message created by 'stegsnow'!

Save that message to a file name basic-answer.txt in your FinalProblem/ directory:

COP3353_test@cop3353:~/FinalProblem$ stegsnow -C basic.txt > basic-answer.txt
COP3353_test@cop3353:~/FinalProblem$ cat basic-answer.txt
312b539b-3c7a-4415-aba0-78b14e2512fc

Hello, COP3353_test!

This is a hidden message created by 'stegsnow'!

For extra credit, try to extract the message from advanced.txt, which has an encrypted version of the hidden message. You will have to find the password for this message. The password is a word from the file /usr/share/dict/words on cop3353.org; you will just have to find which word it is. Once you do solve the problem, save the answer to advanced-answer.txt like you did for basic-answer.txt:

COP3353_test@cop3353:~/FinalProblem$ stegsnow -C -p SOMEPASSWORD advanced.txt > advanced-answer.txt
COP3353_test@cop3353:~/FinalProblem$ cat advanced-answer.txt
718d9acf-71bf-4c96-a1d0-c027b7d5768f

Success, COP3353_test! You have cracked the code!

The easiest way to do this is to write a small Bash script that checks words from the file /usr/share/dict/words. You can ignore all words that begin with capital letters, and you can ignore all possessive forms. It is also safe to assume that your username is part of the message.

Place your script in the FinalProblem/ subdirectory and name it script.sh. Please explain in the comments how to run your script.