User Tools

Site Tools


user:dgirard3:portforlio:puzzle

Project: THE PUZZLE BOX

A project for CSCS1730 UNIX/Linux Fundamentals by Derek Girardi during the Fall 2011 semester.

This project was begun on 10/25/11 and is anticipated to take 1 day.

Objectives

To demonstrate understanding of tools through application of skills, observation, and the ability to reference necessary documentation.

Prerequisites

In order to successfully accomplish/perform this project, the listed resources/experiences need to be consulted/achieved:

  • know how to use the command-line
  • familiarity with using command-line arguments to alter default behaviors of commands
  • know how to bring up and read a manual page
  • familiarity with other resources that provide documentation or usage information

Background

For this project i attempting to see if i know how to use the tools i learned in an effective to navigate through files to find a hidden message. This is a puzzle box because hidden in files there is a secret message and i need to know how to archive, decompress files and text manipulate files to see what is inside. You must know how to use the command file, sed, cp, mv and many others. File allows you to see what kind of file it is, sed allows you to manipulate text through expressions and commands, cp and mv are simple copy and move commands. There is also a rev command that is implmented that is used far into the future box that will come handy. If you can master going through files, manipulateing them and using commands to push your way through, the puzzle box will be no problem to you.

Scope

To apply skills learned in unraveling the puzzle that isn't as it may seem.

Located in /var/public/unix/puzzlebox/ is a filed called courses.html … have at it.

Attributes

State and justify the attributes you'd like to receive upon successful approval and completion of this project.

  • commands: utilization of commands to accomplish the task
  • files & directories: recognize what is being dealt with and act appropriately
  • text processing: retrieve/manipulate text
  • the UNIX shell: perform necessary command-line manipulations to accomplish the task at hand

Procedure

lab46:~$ cd /var/public/unix/puzzlebox
lab46:/var/public/unix/puzzlebox$ ls
courses.html
lab46:/var/public/unix/puzzlebox$ cat courses.html                                                                           Y[Àâ ¶©)¡¡¹©©PÈ16gP0` (-.I,RP`(OMIOÅ£.'1³aøof.0+lV°=²
                                                   ?
                                                    CIFªBb^qyj^IE~'óå¨ù~aóýJ+¸Yþ030°¼`$ÔÆÁà4Èmñ¼>F´(¦A9ùéù¥%`ãÛaÜÞ o¿Ã<w鬦âä¤scá½ÙÙìr~	=]ª[Puìñ4MB¿Úo
                               ^Â4Ié°ì¾
                                       E£þLð{±rmÁ»Ow'N¿Â3å{FÀéºcQÛÊvpLþõüL±üÜ[²¶!99Í»~§½õóàÿ]î¤ìÜÌ"«_¼	=tþuÀ®§9ëHNjf:|?AiOÉÁðZÙ¸ny£}ÛÒm
¿iïO["ªóÂx{jèDÝw¦÷§ý¥V¼ÅÖW£Ù+² ÕÿÔaûjÍËn9Þ¼ºâþo¼Këf9ÎY_"ÒôèVÿcCþé}*Ç£3¸zg½ÈÏ÷òÚ<ó¸½ëÅOJ=Éöðsîͯº²JÉè¬ÒÈ­L?ݼ,å)ªü¼÷Öë<sÇýùö&ɬâɵ°7ªæþ¬,ÙzT°T*Æ/·SwR|7#3®²Þ:hhgD;F
                                     ÅéC\·Â+$	`ÍÊÒÎôsFQ0
FÁ(£`Q0
FÁ(£`Q0
FÁ(£`Q0
FÁ(£`Q0
F:óµ4i(lab46:/var/public/unix/puzzlebox$ 1;2c1;2c1;2c1;2c1;2c^C
lab46:/var/public/unix/puzzlebox$ vi courses.html
lab46:/var/public/unix/puzzlebox$ man html
No manual entry for html
lab46:/var/public/unix/puzzlebox$ ls -l
total 4
-rw-r--r-- 1 wedge unix 681 Oct 19 19:20 courses.html
lab46:/var/public/unix/puzzlebox$ file courses.html
courses.html: gzip compressed data, was "courses.html", from Unix, last modified: Wed Oct 19 19:20:57 2011, max compression
lab46:/var/public/unix/puzzlebox$ man gunzip
lab46:/var/public/unix/puzzlebox$ gzip -d courses.html
gzip: courses.html: unknown suffix -- ignored
lab46:/var/public/unix/puzzlebox$ mv courses.html courses.gz
mv: cannot move `courses.html' to `courses.gz': Permission denied
lab46:/var/public/unix/puzzlebox$ cp courses.html ~     
lab46:/var/public/unix/puzzlebox$ cd
lab46:~$ ls
Harchives.tar.bz2  archivees  cmdcprog.c         exper  irc            program.c           soaringeagle1.sh
Maildir            archives   contact.info.save  hey    killerwasp.sh  pss                 src
a.out              bin        courses.html       hi     lab1a.text     public_html         temp
addscr.sh          botopen    data               hi.c   motd           regularexpressions  temp.c
archive1.tar.gz    candy      destructo.sh       hi.s   newdirectory   scriptrgex.sh       tmp
archive2.zip       closet     dl                 in     program        soaringeagle.sh     wildcards
lab46:~$ mv courses.html courses.gz
lab46:~$ gzip -d courses.gz  
lab46:~$ ls
Harchives.tar.bz2  archivees  cmdcprog.c         exper  irc            program.c           soaringeagle1.sh
Maildir            archives   contact.info.save  hey    killerwasp.sh  pss                 src
a.out              bin        courses            hi     lab1a.text     public_html         temp
addscr.sh          botopen    data               hi.c   motd           regularexpressions  temp.c
archive1.tar.gz    candy      destructo.sh       hi.s   newdirectory   scriptrgex.sh       tmp
archive2.zip       closet     dl                 in     program        soaringeagle.sh     wildcards
lab46:~$ cat courses
lyrics.mp30000644000177400017500000000125511647655460011637 0ustar  wedgelairPK
VS?the answer.txt/UT	ÓZNiVNux
                                üèPNS?F£Oüthe answer.txt/logoutUT	ÄZN±XNux
                                                                                üè½RKNÃP
                                                                                        Üç,ª(TBB,Ø¡ÞB>mPúå¥-pzÆãD ²ûù?¶S¤
                                                                                                                         R"þÐáZüNè©­pÀH>òÝÔ
             ÷hPË~ÆZ¶wçÌsèmÚ=TlQlºûfíNH
                                       ÷Éirñ@«ë3\èUÎbÏô;PºålI¯äÃß`"¼tÁW}^`øFã
-OíKu~A¯tâÚã1$Ç[h                                                            W[AMg<qô62+¿f¤,è3GeU-î5ßÿ&s´=M(JYpOÊÃ?{O)ÓFlK
ÚëÈÖ7^á¯ÊqäiáómÙ`J~vy[juYµ5òÙÓI#ç{
   §^üöìb6xäÖVì%òóó#eÅu\Nm-_PK
VS?íAthe answer.txt/UTÓZNux
                           üèPNS?F£OüíIthe answer.txt/logoutUTÄZNux
                                                                   üèPK°çlab46:~$ 1;2c1;2c1;2c^C
lab46:~$ file courses
courses: POSIX tar archive (GNU)
lab46:~$ ta -zxvf courses
-bash: ta: command not found
lab46:~$ mv courses courses.tar
lab46:~$ ta -zxvf courses.tar
-bash: ta: command not found
lab46:~$ tar -zxvf courses.tar

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
lab46:~$ mv courses.tar courses.tar.gz
lab46:~$ tar -zxvf courses.tar.gz

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
lab46:~$ mv courses.tar.gz courses    
lab46:~$ man tar
lab46:~$ tar -x courses
lab46:~$ tar -t courses
lab46:~$ ls
Harchives.tar.bz2  archivees  cmdcprog.c         exper  irc            program.c           soaringeagle1.sh
Maildir            archives   contact.info.save  hey    killerwasp.sh  pss                 src
a.out              bin        courses            hi     lab1a.text     public_html         temp
addscr.sh          botopen    data               hi.c   motd           regularexpressions  temp.c
archive1.tar.gz    candy      destructo.sh       hi.s   newdirectory   scriptrgex.sh       tmp
archive2.zip       closet     dl                 in     program        soaringeagle.sh     wildcards
lab46:~$ file courses
courses: POSIX tar archive (GNU)
lab46:~$ tar -xvf courses
lyrics.mp3
lab46:~$ file lyrics.mp3
lyrics.mp3: Zip archive data, at least v1.0 to extract
lab46:~$ unzip lyrics.mp3 
Archive:  lyrics.mp3
   creating: the answer.txt/
  inflating: the answer.txt/logout   
lab46:~$ ls
Harchives.tar.bz2  archivees  cmdcprog.c         exper  irc            program             soaringeagle.sh   tmp
Maildir            archives   contact.info.save  hey    killerwasp.sh  program.c           soaringeagle1.sh  wildcards
a.out              bin        courses            hi     lab1a.text     pss                 src
addscr.sh          botopen    data               hi.c   lyrics.mp3     public_html         temp
archive1.tar.gz    candy      destructo.sh       hi.s   motd           regularexpressions  temp.c
archive2.zip       closet     dl                 in     newdirectory   scriptrgex.sh       the answer.txt
lab46:~$ the answer.txt
-bash: the: command not found
lab46:~$ cd the answer.txt
-bash: cd: the: No such file or directory
lab46:~$ file the answer.txt
the:        ERROR: cannot open `the' (No such file or directory)
answer.txt: ERROR: cannot open `answer.txt' (No such file or directory)
lab46:~$ cat the answer.txt
cat: the: No such file or directory
cat: answer.txt: No such file or directory
lab46:~$ mv the answer.txt theanswer.txt
mv: target `theanswer.txt' is not a directory
lab46:~$ cat 'the answer.txt'
cat: the answer.txt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*^*^*^*^
r^e^v^(^1^)^%^i^s^%^a^%^n^i^f^t^y^%^c^o^m^m^a^n^d^.^
lab46:~/the answer.txt$ ./logout
./logout: line 1: *^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^: command not found
./logout: line 5: *^,^!^x^o^b^e^l^z^z^u^p^,^e^h^t^,^t^u^o^,^d^e^r^u^g^i^f^,^e^v^^u^o^Y^,^!^s^n^o^i^t^a^l^u^t^a^r^g^n^o^C^,^*^
*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^
r^u^o^y^,^o^t^,^e^l^i^f^,^s^i^h^t^,^l^i^a^m^-^e^,^s^i^,^w^o^n^,^o^d^,^o^t^,^e^v^a^h^,^u^o^y^,^l^l^A^,^,^
h^s^i^n^i^f^,^e^s^r^u^o^c^,^f^o^,^d^n^a^(^,^t^n^u^o^c^c^a^,^6^4^b^a^l^,^s^^r^o^t^c^u^r^t^s^n^i^,^,^: command not found
./logout: line 6: syntax error near unexpected token `)'
./logout: line 6: `.^)^o^i^l^o^f^t^r^o^p^,^r^u^o^y^,^n^o^,^t^c^e^j^o^r^p^,^r^u^o^y^,^p^u^,^g^n^i^t^i^r^w^,^,^'
lab46:~/the answer.txt$ file logout
logout: ASCII text
lab46:~/the answer.txt$ man  
What manual page do you want?
lab46:~/the answer.txt$ man sed
lab46:~/the answer.txt$ sed ^ logout   
sed: -e expression #1, char 1: unknown command: `^'
lab46:~/the answer.txt$ sed '^' logout
sed: -e expression #1, char 1: unknown command: `^'
lab46:~/the answer.txt$ sed ^' logout
> 
> ^C
lab46:~/the answer.txt$ sed '^' logout^C
lab46:~/the answer.txt$ sed ^' logout
^C
lab46:~/the answer.txt$ sed "^" logout
sed: -e expression #1, char 1: unknown command: `^'
lab46:~/the answer.txt$ cat logout | sed ^
sed: -e expression #1, char 1: unknown command: `^'
lab46:~/the answer.txt$ cd                
lab46:~$ ls
Harchives.tar.bz2  archivees  cmdcprog.c         exper  irc            program             soaringeagle.sh   tmp
Maildir            archives   contact.info.save  hey    killerwasp.sh  program.c           soaringeagle1.sh  wildcards
a.out              bin        courses            hi     lab1a.text     pss                 src
addscr.sh          botopen    data               hi.c   lyrics.mp3     public_html         temp
archive1.tar.gz    candy      destructo.sh       hi.s   motd           regularexpressions  temp.c
archive2.zip       closet     dl                 in     newdirectory   scriptrgex.sh       the answer.txt


lab46:~/the answer.txt$ cat logout | sed 's/\^//g'
*******************************************************
*,!xobelzzup,eht,tuo,derugif,ev'uoY,!snoitalutargnoC,*
*******************************************************
ruoy,ot,elif,siht,liam-e,si,won,od,ot,evah,uoy,llA,,
hsinif,esruoc,fo,dna(,tnuocca,64bal,s'rotcurtsni,,
.)oiloftrop,ruoy,no,tcejorp,ruoy,pu,gnitirw,,
ot,desu,uoy,snoitatnacni,dna,sdnammoc,cificeps,eht,no,tropeR,:oslA,,
.mrof,elbadaer,ylluf,ni,egassem,siht,niatbo,,
*******************************************************
rev(1)%is%a%nifty%command.
lab46:~/the answer.txt$ man rev
lab46:~/the answer.txt$ cat logout | sed 's/\^//g' | rev logout
^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*
^*^,^C^o^n^g^r^a^t^u^l^a^t^i^o^n^s^!^,^Y^o^u^'^v^e^,^f^i^g^u^r^e^d^,^o^u^t^,^t^h^e^,^p^u^z^z^l^e^b^o^x^!^,^*
^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*
^,^,^A^l^l^,^y^o^u^,^h^a^v^e^,^t^o^,^d^o^,^n^o^w^,^i^s^,^e^-^m^a^i^l^,^t^h^i^s^,^f^i^l^e^,^t^o^,^y^o^u^r
^,^,^i^n^s^t^r^u^c^t^o^r^'^s^,^l^a^b^4^6^,^a^c^c^o^u^n^t^,^(^a^n^d^,^o^f^,^c^o^u^r^s^e^,^f^i^n^i^s^h
^,^,^w^r^i^t^i^n^g^,^u^p^,^y^o^u^r^,^p^r^o^j^e^c^t^,^o^n^,^y^o^u^r^,^p^o^r^t^f^o^l^i^o^)^.
^,^,^A^l^s^o^:^,^R^e^p^o^r^t^,^o^n^,^t^h^e^,^s^p^e^c^i^f^i^c^,^c^o^m^m^a^n^d^s^,^a^n^d^,^i^n^c^a^n^t^a^t^i^o^n^s^,^y^o^u^,^u^s^e^d^,^t^o
^,^,^o^b^t^a^i^n^,^t^h^i^s^,^m^e^s^s^a^g^e^,^i^n^,^f^u^l^l^y^,^r^e^a^d^a^b^l^e^,^f^o^r^m^.
^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*
^.^d^n^a^m^m^o^c^%^y^t^f^i^n^%^a^%^s^i^%^)^1^(^v^e^r
lab46:~/the answer.txt$ cat logout | rev | sed 's/\^//g' | sed 's/,/ /g'
*******************************************************
* Congratulations! You've figured out the puzzlebox! *
*******************************************************
  All you have to do now is e-mail this file to your
  instructor's lab46 account (and of course finish
  writing up your project on your portfolio).
  Also: Report on the specific commands and incantations you used to
  obtain this message in fully readable form.
*******************************************************
.dnammoc%ytfin%a%si%)1(ver
lab46:~/the answer.txt$ cat logout | rev | sed 's/\^//g' | sed 's/,/ /g' > ~/Puzzlewin
lab46:~/the answer.txt$ cd
lab46:~$ ls
Harchives.tar.bz2  archive2.zip  closet             dl     in             newdirectory        scriptrgex.sh     the answer.txt
Maildir            archivees     cmdcprog.c         exper  irc            program             soaringeagle.sh   tmp
Puzzlewin          archives      contact.info.save  hey    killerwasp.sh  program.c           soaringeagle1.sh  wildcards
a.out              bin           courses            hi     lab1a.text     pss                 src
addscr.sh          botopen       data               hi.c   lyrics.mp3     public_html         temp
archive1.tar.gz    candy         destructo.sh       hi.s   motd           regularexpressions  temp.c

First step i went to the directory to where the file “courses.html was located”. Second i used the file command to see what kind of file it was, it happened to be a gzip file. Then in orderto change it ( i had to change the extension to gz to decompress it or extract the contents in anyway) i moved it into my home directory so i had permissions to mess with it. then when i decompressed it it turned into “courses”. I used the file command and it was a tar archive. so i used the tar command to recieve the contents lyrics.mp3. I used file again to see it was a zip file and i unzipped it to get an directory named “the answers.txt” so i go into that directory (surrounded by single qoutes because of the space) and i get the executable file “logout”. I open it up and get a mess of kind of visible message. So iused the sed command to replace the carrot's (^) and the comma's and i used the rev command to flip the words around. Then wallah i get the message! I then save it into a new file into my home directory so i can email it.

Reflection

It helped me reinforce that i knew how to use certain commands and decompress files files. Some of it confused for a little bit like when a gzip file had a different exetension but that wasnt hard to get around. All in all, it was a fairly easy project, as long as you know what you are doing.

References

In performing this project, the following resources were referenced:

user/dgirard3/portforlio/puzzle.txt · Last modified: 2011/10/25 20:02 by dgirard3