This Is Not The Course Website You Are Looking For

This course website is from a previous semester. If you are currently in the class, please make sure you are viewing the latest course website instead of this old one.

The goal of this homework assignment is to allow you to practice shell scripting and explore networking in a Unix environment.

For this assignment, record your responses to the following activities in the README.md file in the homework02 folder of your assignments GitLab repository along with any other scripts you create and push your work by 11:59 AM Saturday, February 1.

Activity 0: Pulling Changes

Before starting this homework assignment, you should first perform a git pull to retrieve any changes in your remote GitLab repository:

$ cd path/to/repository                   # Go to assignments repository

$ git checkout master                     # Make sure we are in master branch

$ git pull --rebase                       # Get any remote changes not present locally

You will need to do this from time to time since the TAs will be grading your assignments and merging in your previous work. To integrate these changes into your local repository, you will need to do a git pull to retrieve it from the remote GitLab repository.

Note: If you get the following messages when you do a git push:

! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://gitlab.com/pbui/cse-20289-sp20-assignments'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first merge the remote changes (e.g.,
hint: 'git pull') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

Or:

! [rejected]        master -> master (fetch first)
error: failed to push some refs to '...'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again.  See the 'Note about fast-forwards'
section of 'git push --help' for details

This means you need to perform a git pull and merge in the remote changes before performing a git push as described above.

Don't forget to create a new branch for this assignment:

$ git checkout -b homework02              # Create homework02 branch and check it out

$ cd homework02                           # Go into homework02 folder

Activity 1: Meet the Oracle (6 Points)

The main activity for this assignment is to follow the prompts of MORPHEUS, who takes the form of a program located at:

https://www3.nd.edu/~pbui/teaching/cse.20289.sp20/static/txt/MORPHEUS

You can use either curl or wget to download this program to your homework02 folder in your assignments repository and execute it as follows:

# Go to homework02 directory in assignments repository
$ cd path/to/assignments/homework02

# Download Adventure MORPHEUS
$ curl -LO https://www3.nd.edu/~pbui/teaching/cse.20289.sp20/static/txt/MORPHEUS

# Make MORPHEUS executable
$ chmod +x MORPHEUS

# Run MORPHEUS
$ ./MORPHEUS
...

Student Machines

For this assignment, you will need to use the CSE student machines. This is because MORPHEUS relies on some timing and networking features specific to the student machines.

MORPHEUS will lead you go down the rabbit hole and in order for you to have an audience with the Oracle:

Of course, access to the Oracle is heavily restricted, so you will need to use your hacking skills to locate her. Once you connect with her, she will hopefully give you a message about how to use your awesome Unix skills.

You are to follow the prompts specified by MORPHEUS until you have completed each of the tasks in the journey. Because some tasks depend on others, there is no skipping ahead or going backwards. That said, you can always remove the checkpoints in the tasks.yaml file to go back to a particular task.

At the end of this activity, you should see the following output from the MORPHEUS:

$ ./MORPHEUS
Task 00. Checkout on homework02 branch                                ... Completed
Task 01. IP of current machine                                        ... Completed
Task 02. IP of remote machine                                         ... Completed
Task 03. SSH hopping via jumpbox                                      ... Completed
Task 04. Measuring latency                                            ... Completed
Task 05. Scanning remote ports                                        ... Completed
Task 06. Find the DOORMAN                                             ... Completed
Task 07. Find your LOCKBOX                                            ... Completed
Task 08. Copy remote file                                             ... Completed
Task 09. Crack your LOCKBOX                                           ... Completed
Task 10. Contact the DOORMAN                                          ... Completed
Task 11. Retrieve MESSAGE                                             ... Completed
Task 12. Meet the ORACLE                                              ... Completed
Task 13. Quiz                                                         ... Completed

   Score 10.00

Task Checkpoints

Note, that each task checkpoint in the tasks.yaml is specially encoded for your netid. This means that copying the checkpoint from another student or from a previous task will not work and will lead to a corruption warning that will confuse MORPHEUS. The only way to proceed through the activity is to actually do the tasks!

Matrix Utilities

The following information will help you on your journey:

Command Description Example
curl Request remote file using HTTP. curl https://google.com
find Recursively search file paths. find /etc -name '*ssl*'
host Lookup DNS records for domain or IP address. host nd.edu
ip Display IP address of current machine. ip addr
md5sum Compute checksum of file. md5sum README.md
nc Connect to remote machine for arbitrary communication. nc google.com 80
nmap Scan remote machine for open ports. nmap -v -Pn student00.cse.nd.edu
ping Measure latency to remote machine. ping duckduckgo.com
scp Securely copy files with remote host. scp README.md student01.cse.nd.edu:
sftp Securely transfer files with remote host. sftp student01.cse.nd.edu
ss Display ports and services on current machine. ss -tlp
ssh Securely login to remote host. ssh student01.cse.nd.edu
strings List all strings in a file. strings /bin/ls
traceroute Display hops to remote machine. traceroute nd.edu
wget Download a file via HTTP. wget https://matrix.org

Activity 2: Oracle Quiz (4 Points)

Once you have completed all the tasks specified by the MORPHEUS in Activity 1, you are to complete the following reflection quiz:

As with Reading 01, you will need to store your answers in a homework02/answers.json file. You can use the form above to generate the contents of this file, or you can write the JSON by hand.

Guru Point (1 Extra Credit Point)

For extra credit, you are to customize your favorite $EDITOR by adding useful programming or development extensions and plugins that will make your Unix programming environment more productive. Here are some sources of inspiration:

Nano

Vim

Emacs

If you come across any other tutorials or resources, please share them on Slack.

Verification

To get credit for this Guru Point, show your text editor customizations to the instructor or a TA to verify. You have up until a week after this assignment is due to verify your Guru Point.

Self-Service Extension

Remember that you can always forgo this Guru Point for two extra days to do the homework. That is, if you need an extension, you can simply skip the Guru Point and you will automatically have until Monday to complete the assignment for full credit.

Just leave a note on your Merge Request of your intensions.

Submission

To submit your assignment, please commit your work to the homework02 folder of your homework02 branch in your assignments GitLab repository:

#--------------------------------------------------
# BE SURE TO DO THE PREPARATION STEPS IN ACTIVITY 0
#--------------------------------------------------

$ cd homework02                                       # Go to homework02 directory
...
$ git add Makefile                                    # Mark changes for commit
$ git add MORPHEUS                                    # Mark changes for commit
$ git add tasks.yaml                                  # Mark changes for commit
$ git commit -m "homework02: Activity 1 completed"    # Record changes
...
$ git add answers.json                                # Mark changes for commit
$ git commit -m "homework02: Activity 2 completed"    # Record changes
...
$ git push -u origin homework02                       # Push branch to GitLab

Merge Request

Remember to create a merge request and assign the appropriate TA from the Reading 02 TA List.

DO NOT MERGE your own merge request. The TAs use open merge requests to keep track of which assignments to grade. Closing them yourself will cause a delay in grading and confuse the TAs.