=============================================================== Assignment #10 - Internet, Course Linux Server, Linux, Web/HTML =============================================================== - Ian! D. Allen - idallen@idallen.ca - www.idallen.com Available online: Tuesday March 22, 2011 Upload due date: Upload answer file before 23:59 (midnight) on Monday March 28, 2011 Answers will be posted shortly after the due date/time and discussed in class, if there are any questions about the answers. Late assignments may or may not be marked. 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 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 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. Some of the questions may 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, e.g. Linux commands used to get the answer. ============================================================================== 0. What is the date, time, and room number of your Final Exam? Are you allowed to bring a calculator to your Final Exam? Do you need any pencils for the Final Exam? CST8281: Saturday Apr 23 11h30 (11:30am to 2pm) - T102 - Final exam The other questions are answered here: http://teaching.idallen.ca/cst8281/11w/notes/000_test_instructions.html *** 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. 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) 3. 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 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 128.65.32.17 as a 32-bit hexadecimal number as it would be sent in Internet byte order: 128 = 80h 65 = 41h 32 = 20h 17 = 11h 128.65.32.17 = 80h then 41h then 20h then 11h (Big-Endian byte order) = 80412011h (Big-Endian byte order) 5. Which of the following URLs are always identical to the URL http://idallen.com/address.html ? (May be more than one answer.) a) HTTP://idallen.com/address.html b) http://IDALLEN.COM/address.html c) http://idallen.com/ADDRESS.HTML Answer: A&B only. 6. Which of the following email addresses are always identical to the email address idallen@idallen.ca ? (May be more than one answer.) a) IDALLEN@idallen.ca b) idallen@IDALLEN.CA Answer: B only. 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.256.10 d) 191.0.32.10 e) 255.255.256.255 f) 255.255.255.255 Answer: C&E are invalid. You can't have 256 in an octet. 8. True/False: If two machines with IP addresses 192.0.32.10 and 192.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. 9. True/False: If two machines have similar DNS names, e.g. host1.example.com and host2.example.com, their IP addresses will always be on the same or similar networks, e.g. 192.0.32.10 and 192.0.32.11. FALSE: Similar names do not necessarily mean similar network addresses. 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 form here: 0xCB3B7B72 (Big-Endian) - 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. - 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 "whois" command to find out who owns the above IP address. In what country is that IP address registered? $ whois 203.59.123.114 [...] country: AU Answer: Australia 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.147.30 14. The Perl script being fetched for the attack in the EMail "To" line in 140_attack.txt appears to come from 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 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 * * * 2 * * * 3 gi-1-0-0.cmts02.ym.phub.net.cable.rogers.com (66.185.90.25) 18.911 ms 19.273 ms 19.418 ms 4 gi-0-1-3.gw01.grnsbr.phub.net.cable.rogers.com (24.153.7.1) 24.224 ms 24.391 ms 24.430 ms 5 69.63.250.185 (69.63.250.185) 24.749 ms 25.705 ms 25.746 ms 6 69.63.251.129 (69.63.251.129) 41.319 ms 29.737 ms 32.873 ms 7 eqx-ny3.tlx.nyc.us.oneandone.net (198.32.118.137) 38.183 ms 38.052 ms 37.596 ms 8 so-4-1.bb-c.the.lon.gb.oneandone.net (212.227.120.117) 121.507 ms 121.386 ms 120.548 ms 9 te-1-3.bb-c.bap.rhr.de.oneandone.net (212.227.120.49) 134.427 ms 130.064 ms 129.091 ms 10 ae-4.bb-d.bs.kae.de.oneandone.net (212.227.122.7) 122.618 ms te-4-1.bb-c.bs.kae.de.oneandone.net (212.227.121.167) 123.314 ms ae-4.bb-d.bs.kae.de.oneandone.net (212.227.122.7) 122.808 ms 11 ae-1.gw-distp-a.bs.ka.oneandone.net (212.227.116.210) 126.673 ms 123.287 ms 127.706 ms 12 * * * 13 * * * 14 * * * 15 * * * 16 * * * 17 * * * 18 * * * 19 * * * 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/abcd0001 [replace abcd0001 by your account name] 16. Use "ls -lid" to display the permissions on the above directory and paste the full output for your home directory here: $ ls -lid /home/abcd0001 000000 drwx--x--- 4 abcd0001 www-data 4096 2010-04-07 17:11 /home/abcd0001 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/abcd0001/public_html/ 18. On the CLS, what is the absolute pathname of the directory containing a copy of all the CST8281 course Notes files for this term? $ echo ~idallen/public_html/teaching/cst8281/11w/notes /home/idallen/public_html/teaching/cst8281/11w/notes 19. 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/11w/notes/570_file_transfer.txt 20. 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/11w/notes/week*.txt -OR- $ cd /home/idallen/public_html/teaching/cst8281/11w/notes/ $ grep IETF week*.txt -OR (BEST) - $ cd $ ln -s /home/idallen/public_html/teaching/cst8281/11w/notes n $ grep IETF n/week*.txt 21. Give the absolute pathname on the CLS of the file that would be referenced by the following (nonexistent) URL: http://cst8281.idallen.ca:8080/~abcd0001/one/two.jpg Absolute Path: /home/abcd0001/public_html/one/two.jpg 22. Give two URLs, one private (Algonquin-only) and one public (works on the Internet) for the following absolute (nonexistent) pathname on the CLS: ~abcd0001/public_html/test/image.png Algonquin-only URL: http://10.50.254.148/~abcd0001/test/image.png Internet-wide URL: http://cst8281.idallen.ca:8080/~abcd0001/test/image.png 23. You are using PSFTP on a Windows computer. Your current Windows directory is C:\Temp and you connect using userid abcd0001 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/~abcd0001/tmp/bar.txt (Assume the PSFTP connection connects to the abcd0001 home directory.) (Reference: 570_file_transfer.txt [see heading PSFTP]) psftp> put d:\Vmware\foo.txt public_html/tmp/bar.txt 24. 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 abcd0001 abcd0001 4096 2011-03-22 03:37 public_html/a10 25. 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/~abcd0001/a10/who.txt 26. 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 abcd0001 abcd0001 4096 2011-03-22 03:38 . 673943 drwxr-x--- 3 abcd0001 www-data 4096 2011-03-22 03:37 .. 676506 -rw-r--r-- 1 abcd0001 abcd0001 86 2011-03-22 03:38 who.txt 27. 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 abcd0001 abcd0001 4096 2011-03-22 03:39 . 673943 drwxr-x--- 3 abcd0001 www-data 4096 2011-03-22 03:37 .. 676506 -rw-r--r-- 1 abcd0001 abcd0001 86 2011-03-22 03:38 who.txt c) Can you still use "cat" or "less" to view the who.txt file [yes]? yes d) Can you still view the who.txt file via URL in the web browser [no]? no - "Forbidden" e) Turn on execute permissions 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 abcd0001 abcd0001 4096 2011-03-22 03:40 . 673943 drwxr-x--- 3 abcd0001 www-data 4096 2011-03-22 03:37 .. 676506 -rw-r--r-- 1 abcd0001 abcd0001 86 2011-03-22 03:38 who.txt g) Can you again view the who.txt file in the web browser [yes]? yes 28. You are in the directory ~abcd0001/public_html/a10 on the CLS. You want to move a file named "foo.txt" from the abcd0001 home directory into the directory ~abcd0001/public_html/tmp using the shortest possible relative path names. What command do you use? $ mv ../../foo.txt ../tmp *** The Web - [see 600_basic_html.ppt] *** 29. 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. 30. 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. 31. What gets stored in the disk files that are served up by a Web server? Mostly plain-text, marked-up with HTML tags. HTML files may refer to other things such as images and style sheets. 32. What protocol is used to send Web pages across the Internet? HTTP "Hyper-Text Transfer Protocol" (over the underlying TCP/IP) 33. 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 serer, 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. 34. 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. 35. What is the URL of the W3C web page validator service? http://validator.w3c.org/ 36. 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. 37. True/False: Every opening HTML tag has a corresponding closing tag. False, e.g. ,
, , 38. 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.

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

    

40. 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. 41. What tag pair are mandatory inside the section? 42. Which heading usually prints larger,

or

?

is larger than

43. How do you write a comment in HTML? 44. True/False: You can nest HTML comments inside HTML comments. False - comments stop as soon as a pair of dashes is found. 45. True/False: This is a valid comment: <-- Hello World! --> False - missing leading '!' 46. True/False: This is a valid comment: <-- See -- Saw --> False - missing leading '!' False - you can't put "--" inside a comment. 47. True/False: This is a valid comment: False - you can't put "--" inside a comment. False - you can't put '!' at the end. 48. True/False: This is a valid comment: False - you can't put "--" inside a comment. 49. True/False: This is a valid comment: True 50. True/False: The major attribute of the tag is "http=" followed by a relative or absolute file or URL address. False - the tag contains "href=" 51. 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 send email where the displayed text does not match the URL link. 52. What is the syntax for an EMail address used in an link? ....... 53. True/False: When using the tag, the attribute that points to the image itself is named "image=". False - the tag contains "src=" 54. Write an tag that references the image file "foo.png" stored in the parent directory (not in the current directory). The image size is 800x600 pixels and shows a Linux penguin dancing. A dancing Linux penguin 55. 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. -- | 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/