**Quest #1: __The Puzzle Box__** =====Background===== The filetype of a file can be extremely important when determining what application is used to open it. Most of the time a file is named correctly, for instance a file ending in .c can be assumed to be the source code of a C program, or .gz to be a gzipped file. With the dircolors utility colorizing specific files, it is further assuming that files which end in .mpg are really MPEG files and colors them accordingly, and the same for .zip files, etc. In other operating systems, a file's extension determines what application is used to open the particular file. If a file that ends in .mp3 is really a .png file, the default MP3 player is going to have difficulties. Sometimes files are not always named properly, either due to a web browser mangling an extension or for whatever reason. When a file is more than meets the eye, we must rely on the various tools available to use to determine what in fact it is. In UNIX there is a nifty little spell called **file** that attempts to determine the actual type of a file by checking a series of properties. From the **file**(**1**) man page: There are three sets of tests, performed in this order: - filesystem tests, - magic number tests, - and language tests. The first test that succeeds causes the file type to be printed. A filesystem test checks to see if the file is non-ordinary (such as a socket, symbolic link, or other special file). The magic number test is a check of files conforming to existing fixed formats, typically by examining the file at the binary level. If using a hex editor, you will find that .gz files should always start with the same sequence of hexadecimal values. Finally, if the file is determined to be a simple ASCII file, it will attempt to analyze whether or not it conforms to some language (ie C source code vs. an HTML document). Note that **file** is not always perfect, but for most cases will get the job done. Try checking files in your home directory or elsewhere on the system and see the results. Refer to the **file**(**1**) manual page or your textbook for more information. =====Test Drive===== Go ahead and run **file** against various files in your home directory... note the responses that it gives. Try it against the following files: * /etc/motd * /etc/passwd * /bin/ls * / * /lib/libc-2.3.6.so The **file** spell can be a useful litmus test in many scenarios for determining the type of file you are dealing with. This is important when you may encounter uncertainties over a file's actual type. =====The Quest===== As you are wandering around the system, your increasingly attuned UNIXy senses detect a buzz in the air-- a new quest has unfurled its glory upon the universe! This time, to get started, you need to make an offering to that which beholds the core of the quest. "No problem!" you think to yourself, as we just had made and //enjoyed// some cake in our closet not too long ago. ====Step 0. Create your offering==== An offering, in this case, is quite simply a file named "offering". But like any good offering, it needs to contain substance: lab46:~$ echo "substance" > offering lab46:~$ Bam! Offering created. ====Step 1. Present our offering==== Next, we need to give our offering... this can be done by sending our offering through the data portal that resides in our house. Convenient, isn't it? So let's do that: lab46:~$ mv offering data lab46:~$ Now we await the response of the universe at large. As we wait anxiously in our house, we contemplate the potpourri of wonders that is likely to flavour our current experience this day. ====Step 2. A gift arrives!==== Suddenly, and with a sort of enthusiastic rustling, a tingly sensation rises in the back of your neck, and a sound resembling sparkling water carefully sitting on a store shelf permeates the air. And lo! What's that? Sitting right there in the midst of your home??? lab46:~$ ls You should see, among the various treasures in your home, a new visitor, one by the name of: **puzzle.box** Our quest is at hand!!! ====Step 3. Unravelling the puzzle==== This time, our very wits are put to the test as we intellectually wrangle with the challenge put forth to us. A thought then resonates through your psyche, as if in contact telepathically with some other being, only to realize the very universe is in concert with you. The following idea is left for you to ponder: "Inside this puzzle.box lies a message. Plain though it may be, it lies within a crypt of obfuscation, designed to keep all but the diligent and observant at bay. Unravel the mystery, and follow the guidance therein, and achieve success in solving this puzzle." Armed with the knowledge and experience of our adventures thus far, our spells, and the magical unix manual pages, we must pursue this latest of quests to achieve limitless bliss, for great justice! This quest is now afoot!