COP4342 - 2017 Spring
Web server assignment

Please visit

Your assignment is to recreate the same sort of site on the machine

Please use the following scheme for your port number: from the attendance roster, note which number is beside your name. Add 43000 to that number; for instance, if the number beside your name was 59, you would put your server on port 43059, and would access your service as

You should create two BASH scripts to do this: a script called "~/bin/start-server", and a script called "~/httpd/cgi-bin/cryptoquote".

In your "start-server" script, please use busybox's built-in webserver. You can access this functionality by creating a soft-link in ~/bin to /bin/busybox.

I would suggest that your "start-server" script first try to kill any existing httpd processes using pkill.

COP4342_test@(none):~$ ls -lR
total 8
drwxr-xr-x 2 COP4342_test COP4342_test 4096 Jan 31 17:21 bin
drwxr-xr-x 3 COP4342_test COP4342_test 4096 Jan 31 16:54 httpd

total 8
lrwxrwxrwx 1 COP4342_test COP4342_test 12 Jan 31 16:40 httpd -> /bin/busybox
-rwxr-xr-x 1 COP4342_test COP4342_test 64 Jan 31 17:19 start-server

total 4
drwxr-xr-x 2 COP4342_test COP4342_test 4096 Jan 31 17:23 cgi-bin

total 4
-rwxr-xr-x 1 COP4342_test COP4342_test 868 Jan 31 17:16 cryptoquote
Finally, your "start-server" script should start up the server in a fashion that will allow you to log out but still keep the server going.

In your "cryptoquote" script, this should be a simple Bash file that sends as output:

Content-type: text/html


[[[ Enciphered upcased content from fortune -l ]]]

<i>Highlight below to see answer</i>
<font color="white"><tt> ABCDEFGHIJKLMNOPQRSTUVWXYZ = [[[ Substitution code key ]]]  </tt></font>
<p><font color="white"><tt>

[[[ Original content from fortune -l that has been upcased]]]


The areas in [[[ ]]] are not literal; instead, these should be generated by your program. The first [[[ ]]] is the encrypted, upcased version of the fortune (from running "fortune -l"); the second [[[ ]]] is the substitution key, and the third [[[ ]]] is from upcasing the output of "fortune -l". You use parts two and three to compute part one, thus this means that you will have to save these results. YOU MAY NOT USE TEMPORARY FILES FOR THIS. Use ordinary BASH variables, not temporary files.

Embellishment: yes, you may embellish your output. For instance, you could draw boxes around various bits, or you could make the answer showier by adding some javascript rather than the rather hacky "highlight" method used above — there are literally a host of ideas for improving the output.

Submission: Please tar up your ~/bin/ and ~/httpd/ directories and submit the tar file on Blackboard. If your program uses temporary files, you will get a zero.