=============================================================== Assignment #10 - Internet, Course Linux Server, Linux, Web/HTML =============================================================== - Ian! D. Allen - idallen@idallen.ca - www.idallen.com Read *all* the words in this assignment. Goal: Demonstrate working knowledge of Internet services. Refresh Linux knowledge from previous term. Demonstrate knowledge of basic HTML. Available online: Tuesday November 8, 2011 Deliverables: One correctly-named plain text file uploaded to Blackboard. Upload due date: Upload answer file before 10h00 (10am) on Saturday November 19, 2011 Late assignments or wrong file names may or may not be marked. Answers will be posted shortly after the due date/time and discussed in class, if there are any questions about the answers. Submission method: Create a plain text file using the *exact* name: assignment10.txt Upload the file via the Assignment10 "Upload File" facility in Blackboard. Use "Attach File" and "Submit" to upload your plain text file. No wordprocessor documents. Do not send email. Use only "Attach File". Use the *exact* file name given above. Upload only one single file of plain text, not HTML, not MSWord. No fonts, no word-processing. Plain text only. Did I mention that the format is plain text (VIM/Nano/Pico/Gedit or Notepad)? NO WORD PROCESSOR, PDF, RTF, or HTML DOCUMENTS ACCEPTED. No marks are awarded for submitting under the wrong assignment number. Not all assignments will be marked. See the Week 1 Notes for details. Answers will be posted after the due date/time so that you can check your answers before coming to class and ask questions about the answers in class. Please check your answers (and my answers!). I go over each assignment in class if there are questions about the answers. No questions means no review - I'll presume you know the material. Questions similar to ones on these assignments will appear on your tests and exams. DO THIS: Edit this file and answer the following questions underneath each question, showing the method or formula you used to get the answer. Many of the questions already give you the answer - you must show the full method you use to generate that answer. Upload the file containing the question, methods, formulas, and answers before the due date. Some of the answers below will require reading the links published in the weekly course notes. Full marks are awarded only if you show your method, the same method you will have to use on your midterm test and final exam. Marks are awarded for original work, not for cut-and-paste. Any answers that are found to be cut-and-paste from some other document will require you to resubmit the entire lab as hand-written (and may result in a charge of plagiarism or academic fraud as well). Do your own thinking; write your own answers. ============================================================================== 0. What is the date, time, and room number of your Final Exam? Are you allowed to bring a calculator to your Final Exam? Are you allowed to bring a cell phone or PDA to your Final Exam? How many pencils and erasers are needed at your Final Exam? *** Internet Section *** 1. What byte-order is used on the Internet to transmit data? The Internet is Big Endian. Most Significant Byte goes First. On the Internet, the dotted-quad IP address 1.2.3.4 would be sent as 1 followed by 2 followed by 3 followed by 4. In hexadecimal form, the 32-bit IP address is written in Big-Endian form as 01020304h. The 01 (Big End) would be first and the 04 last. Stored on Big-Endian hardware, the 01 would be first in memory and the 04 would be last. On Little-Endian hardware, the same 32-bit IP address 01020304h has to be stored in memory with the Little End (04) first. To properly represent the 32-bit IP address 01020304h on Little-Endian hardware, we must put the bytes in memory the other way around, with 04 first in memory and 01 last. As a L.E. memory dump: 04 03 02 01 .... 2. In the world of Internet standards, what do the letters "RFC" stand for? (Hint: http://en.wikipedia.org/wiki/RFC_Editor) Request For Comment - Internet standards 3. What is the standards group responsible for the Internet standards? Give the full name and the 4-letter acronym. (Hint: http://en.wikipedia.org/wiki/IETF) Internet Engineering Task Force (IETF) 4. IPv4 addresses are stored as 32-bits, where each of the four "quads" is stored in its own byte. Encode the dotted-quad IP address 130.66.34.18 as a 32-bit hexadecimal number as it would be sent in Internet byte order: 130 = 82h 66 = 42h 34 = 22h 18 = 12h 130.66.34.18 = 82h then 42h then 22h then 12h (Big-Endian byte order) = 82422212h (Big-Endian byte order) 5. Which of the following URLs are *always* identical to the URL http://idallen.net/content.html ? (May be more than one answer.) a) http://idallen.net/CONTENT.HTML b) http://IDALLEN.NET/content.html c) HTTP://idallen.net/content.html Answer: B&C only. The content part of a URL may be case-sensitive. 6. Which of the following email addresses are always identical to the email address idallen@idallen.com ? (May be more than one answer.) a) idallen@IDALLEN.COM b) IDALLEN@idallen.com Answer: A only. The userid part may be case-sensitive (but usualy isn't). 7. Which of the following cannot ever be valid dotted-quad IPv4 addresses? (May be more than one answer.) a) 0.0.0.0 b) 1.2.3.4 c) 252.0.255.10 d) 191.0.320.10 e) 255.255.255.255 f) 255.255.260.255 Answer: D&F are invalid. You can't have 320 or 260 in an octet. 8. True/False: If two machines have similar DNS names, e.g. machine1.example.com and machine2.example.com, their IP addresses will always be on the same or similar networks, e.g. 205.0.32.10 and 205.0.32.11. FALSE: Similar names do not necessarily mean similar network addresses. 9. True/False: If two machines with IP addresses 205.0.32.10 and 205.0.32.11 are on the same network, they will always have similar DNS names, e.g. host1.example.com and host2.example.com . FALSE: Adjacent addresses do not necessarily mean similar DNS names. 10. How many bits are used to store the new IPv6 Internet addresses? 128 bits. 11. In Class Notes file 140_attack.txt: Decode the obfuscated IP address assigned in hexadecimal to the $perm variable into standard Internet numeric dotted-quad form. $perm="\x32\x30\x33\x2e\x35\x39\x2e\x31\x32\x33\x2e\x31\x31\x34"; 2 0 3 . 5 9 . 1 2 3 . 1 1 4 Give the dotted-quad IP address here: 203.59.123.114 203 = CBh 59 = 3Bh 123 = 7Bh 114 = 72h The IP Address 203.59.123.114 must read as the 32-bit number CB3B7B72h no matter what the byte order of the underlying hardware. On Big-Endian hardware, the byte order of the 32-bit number CB3B7B72h is the same as the byte order of the individual bytes stored in memory: Give the 32-bit hexadecimal Big-Endian form here: CB3B7B72h - In a B.E. memory dump, it would show as: CB 3B 7B 72 (big end first) - If these bytes are sent out in order, from lowest memory to highest, the CB goes first and this is correct for Big-Endian byte order. The IP Address 203.59.123.114 must read as the 32-bit number CB3B7B72h even on Little-Endian hardware. The value of the 32-bit number is the same, and it is written the same way, but on Little-Endian hardware the 32-bit number CB3B7B72h is stored in memory with the bytes reversed: Give the same address in Little-Endian form (hex): CB3B7B72h - In a L.E. memory dump, it would show as: 72 7B 3B CB (litte end first) - If these bytes are sent out in order, from lowest memory to highest, the 72 goes first and this is WRONG for Internet byte order! You have to swap (reverse) the four bytes before sending the value out. *** Using the Course Linux Server (CLS) cst8281.idallen.ca *** CLS = "Course Linux Server" 12. Use the Linux "host" command to find out the DNS name for the above IP address. $ host 203.59.123.114 114.123.59.203.in-addr.arpa domain name pointer 203-59-123-114.perm.iinet.net.au. 13. In March 2010 the attack email listed in 140_attack.txt was "Received" from machine mail.modaintl.com at 68.236.170.186. Use the Linux "host" command to show the current IP address for mail.modaintl.com. (It isn't 68.236.170.186 today.) $ host mail.modaintl.com mail.modaintl.com has address 72.248.219.2 14. The Perl script being fetched for the attack in the EMail "To" line in 140_attack.txt appears to contain a German (.de) address. Use the Linux "traceroute" command to trace the packet routes between your current machine and the German address. (The trace may take some time to complete. It may not be able to trace the name of every router on the way to the destination - some trace points will be asterisks instead of host names.) Copy and paste the traceroute here: $ traceroute www.linux-echo.de traceroute to www.linux-echo.de (217.160.205.164), 30 hops max, 60 byte packets 1 wr-t209-1-v254.algonquincollege.com (10.50.254.1) 0.286 ms 0.275 ms 0.419 ms 2 wr-c302-101-v424.algonquincollege.com (10.29.102.33) 0.412 ms 0.576 ms 0.572 ms 3 aip42-150.algonquincollege.com (205.211.42.150) 0.540 ms 0.838 ms 1.609 ms 4 ws-c302-border1-v40.algonquincollege.com (205.211.40.52) 6.845 ms 7.147 ms 7.383 ms 5 10.29.43.5 (10.29.43.5) 4.671 ms 4.931 ms 5.091 ms 6 ws-c302-border1-v441.algonquincollege.com (10.29.41.2) 7.466 ms 7.193 ms 7.406 ms 7 * * * 8 * * * 9 * * * 10 * * * 11 * * * 12 * * * 13 * * * 14 * * * 15 * * * 16 * so-4-1.bb-c.the.lon.gb.oneandone.net (212.227.120.117) 137.598 ms 138.697 ms 17 te-1-3.bb-c.bap.rhr.de.oneandone.net (212.227.120.49) 142.082 ms 142.442 ms 142.668 ms 18 ae-1.bb-c.tp.kae.de.oneandone.net (212.227.121.167) 139.658 ms 141.279 ms 141.275 ms 19 ae-1.gw-distp-a.bs.ka.oneandone.net (212.227.116.210) 140.778 ms 141.236 ms 141.526 ms 20 * * * 21 * * * 22 * * * 23 * * * 24 * * * 25 * * * 26 * * * 27 * * * 28 * * * 29 * * * 30 * * * *** Operating Systems Review on the Course Linux Server (CLS) *** CLS = "Course Linux Server" 15. What is the absolute pathname of your CLS home directory? Show the command(s) you used to find out this information. $ cd $ pwd /home/abcd1234 [replace abcd1234 by your account name] 16. Use "ls -lid" to display the permissions on the above directory and paste the full one-line output for your home directory here: $ ls -lid /home/abcd1234 123456 drwx--x--- 4 abcd1234 www-data 4096 2011-11-07 17:11 /home/abcd1234 17. What is the absolute pathname of the CLS directory containing your Assignment 09 "minimal.html" file? Show the comands you used. $ cd public_html $ pwd /home/abcd1234/public_html/ 18. Use "ls -lid" to display the permissions on the above directory and paste the full one-line output here: $ ls -lid /home/abcd1234/public_html 123456 drwxr-xr-x 4 abcd1234 abcd1234 4096 2011-11-07 17:11 /home/abcd1234/public_html 19. On the CLS, what is the absolute pathname of the directory containing a copy of all the CST8281 course Notes files for this term, as mentioned in the course notes file for the Course Linux Server? $ echo ~idallen/public_html/teaching/cst8281/11f/notes /home/idallen/public_html/teaching/cst8281/11f/notes 20. Use "ls -lid" to display the permissions on the above directory and paste the full one-line output here: $ ls -lid ~idallen/public_html/teaching/cst8281/11f/notes 1195927 drwxr-xr-x 4 idallen idallen 4096 2011-11-04 10:49 /home/idallen/public_html/teaching/cst8281/11f/notes 21. On the CLS, what is the absolute pathname of the 570_file_transfer.txt file in the preceding CST8281 course Notes directory? /home/idallen/public_html/teaching/cst8281/11f/notes/570_file_transfer.txt 22. How would you use file patterns and "grep" on the CLS to find out which of the many Week Notes files contain the string "IETF"? $ grep 'IETF' /home/idallen/public_html/teaching/cst8281/11f/notes/week*.txt -OR- $ cd /home/idallen/public_html/teaching/cst8281/11f/notes/ $ grep 'IETF' week*.txt -OR (BEST - create a symbolic link to the notes) - $ cd $ ln -s /home/idallen/public_html/teaching/cst8281/11f/notes n $ grep 'IETF' n/week*.txt 23. Give the absolute pathname on the CLS of the file that would be referenced by the following (nonexistent) URL: http://cst8281.idallen.ca:8080/~abcd1234/dir/pic.png Absolute Path: /home/abcd1234/public_html/dir/pic.png The "~abcd1234" translates to the public_html directory of abcd1234. 24. Give two URLs, one private (Algonquin-only) and one public (works on the Internet) for the following absolute (nonexistent) pathname on the CLS: ~abcd1234/public_html/dir/image.png Algonquin-only URL: http://10.50.254.165/~abcd1234/dir/image.png Internet-wide URL: http://cst8281.idallen.ca:8080/~abcd1234/dir/image.png The leading "~abcd1234" is some shell shorthand for the home of abcd1234. The public_html directory in the home translates to "~abcd1234" in the URL. Note tht the URL does *not* mention the public_html directory. 25. You are using PSFTP on a Windows computer. Your current Windows directory is C:\Temp and you connect using userid abcd1234 to the CLS. Give the "put" command that will copy a local file "foo.txt" from the "Vmware" folder on your Windows "D:" drive to the CLS so that the following URL will display the contents of that file. Note the new file name used in this URL: http://cst8281.idallen.ca:8080/~abcd1234/tmp/bar.txt (Assume the PSFTP connection connects to the abcd1234 home directory.) (Reference: 570_file_transfer.txt [see heading PSFTP]) psftp> put d:\Vmware\foo.txt public_html/tmp/bar.txt 26. Create the directory "public_html/a10" under your CLS home directory. (Do not include the quote marks.) Use "ls -lid" with the above pathname to show the permissions of the a10 directory and paste the full output here: $ cd $ mkdir public_html/a10 $ ls -lid public_html/a10 123456 drwxr-xr-x 2 abcd1234 abcd1234 4096 2011-11-22 03:37 public_html/a10 27. Go to your home directory on the CLS. Redirect the output of the Unix "who" command into the file "who.txt" in the above "a10" directory. (Do not include the quote marks.) Verify that you can see the contents of the who.txt file using a web browser (e.g. Firefox) using the appropriate URL. Give the command used and the URL used. $ who >public_html/a10/who.txt Web URL: http://cst8281.idallen.ca:8080/~abcd1234/a10/who.txt 28. Use "ls -liac" on the "a10" directory to show the permissions of the directory and all the files inside it. Paste the output here: $ cd $ ls -liac public_html/a10 673968 drwxr-xr-x 2 abcd1234 abcd1234 4096 2011-11-22 03:38 . 673943 drwxr-xr-x 3 abcd1234 abcd1234 4096 2011-11-22 03:37 .. 676506 -rw-r--r-- 1 abcd1234 abcd1234 86 2011-11-22 03:38 who.txt 29. Turn off execute permission for "others" on the "a10" directory. a) What command turns off execute permission for "others"? $ chmod o-x public_html/a10 b) Use "ls -liac" to generate a listing showing the new permissions of the "a10" directory and all its contents and paste the output here: $ ls -liac public_html/a10 673968 drwxr-xr-- 2 abcd1234 abcd1234 4096 2011-11-22 03:39 . 673943 drwxr-xr-x 3 abcd1234 abcd1234 4096 2011-11-22 03:37 .. 676506 -rw-r--r-- 1 abcd1234 abcd1234 86 2011-11-22 03:38 who.txt c) Can you still use "cat" or "less" to view the who.txt file [yes]? yes d) What error message does your browser now give for that file? "Forbidden" e) Turn on execute permissions for "others" on the "a10" directory. What command did you use to do this? $ chmod o+x public_html/a10 f) Use "ls -liac" to generate a listing showing the restored permissions of the "a10" directory and its contents and paste it here: $ ls -liac public_html/a10 673968 drwxr-xr-x 2 abcd1234 abcd1234 4096 2011-11-22 03:40 . 673943 drwxr-xr-x 3 abcd1234 abcd1234 4096 2011-11-22 03:37 .. 676506 -rw-r--r-- 1 abcd1234 abcd1234 86 2011-11-22 03:38 who.txt g) Verify that you can again view the who.txt file in the web browser. Can you still view the file if you remove read permissions for "others" from the a10 directory? yes 30. You are in the directory ~abcd1234/public_html/a10 on the CLS. You want to move a file named "foo.txt" from the abcd1234 home directory into the directory ~abcd1234/public_html/a11 using the shortest possible relative path names. What command do you use? $ mv ../../foo.txt ../a11 *** The Web - [see 600_basic_html.ppt] *** 31. What is the World Wide Web? A world-wide network of computers that provide HTML pages and other resources using the HTTP protocol over the Internet. 32. What is the difference between HTTP and HTML? HTTP "Hyper-Text Transfer Protocol" is the Internet standard communication protocol used for transferring HTML and web-related data. HTML "Hyper-Text Mark-up Language" is a mark-up language used to mark-up text files so that they render nicely in a web browser. 33. What gets stored in the disk files that are served up by a Web server? Describe the contents of these files. What kind of stuff is in them? Mostly plain-text, marked-up with HTML tags. HTML files may refer to other things such as images and style sheets. 34. What protocol is used to send Web pages across the Internet? HTTP "Hyper-Text Transfer Protocol" (over the underlying TCP/IP) 35. Describe how your Web browser acts to fetch and display a Web page. The browser looks up the IP address of the host name contained in the URL and connects to the HTTP port on that server (usually port 80). To that server, your browser sends an HTTP request for a resource, usually an HTML file. The server returns the requested resource. If the resource is an HTML page containing links to other resources (such as images or CSS style sheets), your browser will make additional requests to the server to fetch those resources. 36. True/False: Line breaks in HTML appear as line breaks in your Web page. False, under most circumstances. There are HTML tags which can be used to preserve line breaks. 37. What is the URL of the W3C web page validator service? http://validator.w3.org/ 38. To what does the name "Apache" refer in the Web? (What is "Apache"?) Apache is the name of a popular open-source web server package. 39. True/False: Every opening HTML tag has a corresponding closing tag. False, e.g. ,
, , 40. True/False: A valid Web page could be a single line of text. True - HTML pages are free-form and newlines don't matter except inside
 elements.

41. Give three examples of HTML tags that have no closing tag:

    

42. What is an HTML "element"? An HTML element is a tagged individual component of an HTML document. An element includes the opening tag, its attributes (if any), its content (if any), and the matching closing tag (if any). The element includes the entire web page. 43. What tag pair are mandatory inside the section? 44. Which heading usually prints smaller,

or

?
is usually smaller than

but CSS can change that. 45. How do you write a comment in HTML? 46. True/False: You can nest HTML comments inside HTML comments. False - comments stop as soon as a pair of dashes is found. 47. True/False: This is a valid comment: <-- See -- Saw --> False - missing leading '!' False - you can't put "--" inside a comment. 48. True/False: This is a valid comment: <-- Hello World! --> False - missing leading '!' 49. True/False: This is a valid comment: False - you can't put "--" inside a comment. False - you can't put '!' at the end. 50. True/False: This is a valid comment: True 51. True/False: This is a valid comment: False - you can't put "--" inside a comment. 52. Give the major attribute of the tag that points to a relative or absolute file or URL address: href= 53. True/False: the address used in the attribute on an tag must match the text displayed in the browser for that attribute. False - the attribute and the text are not related, e.g. This is any unrelated text. Attackers create web pages (including web email) where the displayed text does not match the URL link. 54. What is the syntax for an EMail address used in an link? ....... 55. Give the tag attribute that points to the image itself: src= 56. Write an tag that references the image file "img.png" stored in the parent directory (not in the current directory). The image size is 600x800 pixels and shows a Linux penguin eating herring. A Linux penguin eating herring 57. Write here, from memory, the smallest valid Web page that displays "Hello World!", including all the mandatory tags. You can omit the details on the DOCTYPE header line (don't memorize it). Required Tags

Hello World! This is the smallest valid web page. All tags are required.

Full marks are awarded only if you show your method, e.g. Linux commands used to get the answer. Marks are awarded for original work, not for cut-and-paste. Any answers that are found to be cut-and-paste from some other document will require you to resubmit the entire lab as hand-written (and may result in a charge of plagiarism or academic fraud as well). Do your own thinking; write your own answers. -- | Ian! D. Allen - idallen@idallen.ca - Ottawa, Ontario, Canada | Home Page: http://idallen.com/ Contact Improv: http://contactimprov.ca/ | College professor (Free/Libre GNU+Linux) at: http://teaching.idallen.com/ | Defend digital freedom: http://eff.org/ and have fun: http://fools.ca/