{ "q1": { "type": "order", "question": "\n

\nOrder the following networking utilities to match the descriptions\nbelow.\n

\n\n

\n

    \n\n
  1. Find the ip address of all the networking devices on the current\n machine.
  2. \n\n
  3. Find the ip address of a remote machine along with other DNS\n records.
  4. \n\n
  5. Measure the latency to a remote machine or check if another\n machine is responsive.
  6. \n\n
  7. Securely transfer a file from one machine to another.
  8. \n\n
  9. Synchronize files between machines.
  10. \n\n
  11. Download a file from a website.
  12. \n\n
  13. List what ports or services are available on the current machine.
  14. \n\n
  15. Scan a remote machine to see what ports are open.
  16. \n\n
  17. Make arbitrary network connections to a remote machine.
  18. \n\n
  19. List the machines traversed in a network connection.
  20. \n\n
\n

\n\n

\nNote: You may need to lookup additional resource for some of these commands.\n

\n", "responses": { "rsync": "rsync", "traceroute": "traceroute", "nmap": "nmap", "ip": "ip", "nc": "nc", "ping": "ping", "ss": "ss", "host": "host", "curl": "curl", "scp": "scp" } }, "q3": { "type": "blank", "question": "\n

\nUse the find command on the /etc folder on\nstudent00.cse.nd.edu to answer the following questions:\n

\n\n

\n

    \n\n
  1. How many files are there? ____
  2. \n \n
  3. How many directories are there? ____
  4. \n \n
  5. How many executable files are there? ____
  6. \n \n
  7. How many empty files are there? ____
  8. \n\n
  9. How many files and directories have the string 'host' in the name? ____
  10. \n\n
\n

\n" }, "q2": { "type": "blank", "question": "

\nUsing some of the utilities from Q1, answer the following questions:\n

\n\n

\n

    \n\n
  1. What is the public IP Address of student00.cse.nd.edu? ____
  2. \n\n
  3. What is the IP Address of dredd.h4x0r.space? ____
  4. \n\n
  5. How many ports are open on dredd.h4x0r.space? ____
  6. \n\n
  7. How many hops are there between student00.cse.nd.edu and xavier.h4x0r.space? ____
  8. \n\n
  9. How large is the file https://yld.me/raw/CoM? ____ bytes
  10. \n\n
\n

\n" }, "q5": { "type": "multiple", "question": "\n

\nGiven the exists.sh script in Q4, which of the\nfollowing statements are true (choose all that apply)?\n

\n", "responses": { "file": "The test -e line checks if the file referenced by the variable exists.", "extension": "The #!/bin/sh line specifies the file extension.", "shebang": "The #!/bin/sh line specifies the interpreter to use when the script is executed.", "variable": "The test -e line checks if the number referenced by the variable exists.", "argument": "The $1 represents the first argument to the script.", "number": "The $1 represents the number 1." } }, "q4": { "type": "blank", "question": "\n

Given the following output of ls -l:

\n\n
\n-rw-r--r-- 1 pbui pbui  23 Jan 18 15:39 README.md\n-rw-r--r-- 1 pbui pbui 155 Jan 25 01:15 exists.sh\n
\n\n

And the following script, exists.sh:

\n\n
\n#!/bin/sh\n\nif test -e \"$1\"; then\n    echo \"$1 exists!\"\nelse\n    echo \"$1 does not exist!\"\nfi\n
\n\n

\n

    \n
  1. How would you run the script even those it is not executable? ____
  2. \n
  3. How would you make this script executable? ____
  4. \n
  5. Once this script is executable, how would you run it directly? ____
  6. \n
\n

\n" }, "q6": { "type": "blank", "question": "\n

We wish to create a new version of the exists.sh script in\nQ4 with the following modifications:

\n\n

\n

    \n\n
  1. Use [ instead of test for the conditional.
  2. \n\n
  3. Check every command line argument (one at a time).
  4. \n\n
  5. Return an error code (1) if one of the checks fails.
  6. \n\n
  7. Display an error message and exit with an error if no arguments are given.
  8. \n\n
\n

\n\n

Fill in the missing code in the script below to complete this new\nversion of exists.sh:

\n\n
\n#!/bin/sh\n\n# Check if there are no arguments\nif [ \"____\" ____ 1 ]; then\n    \u00a0\u00a0\u00a0echo \"Usage: exists.sh file0...\"\n    \u00a0\u00a0\u00a0exit ____\nfi\n\n# Check each command line argument\nEXITCODE=____\nfor arg in \"____\"; do\n    # Check if argument exists\n    if [ ____ \"____\" ]; then\n        echo \"____ exists!\"\n    else\n        echo \"____ does not exist!\"\n        EXITCODE=____\n    fi\ndone\n\nexit ____\n
\n" } }