<<

Name: Date: IT/CS780

IT/CS780 Laboratory Assignment 3 (worth 15 points)

Introduction: This laboratory assignment is designed to introduce students to the application layer of the OSI model and developing networked applications. This laboratory assignment will focus on the Hyper Text Transfer Protocol (HTTP) as defined by RFC 7230 (available from https://tools.ietf.org/html/rfc7230 ).

Students are expected to analyze the source code for a given application and trace its origin to standards defined in the appropriate RFC. Additionally, students will be introduced to rudimentary scripting, and packet analysis via a protocol analyzer.

Software Dependencies: This assignment will leverage the Netcat program to provide access to TCP and UDP sockets. The Netcat program is preinstalled on laboratory machines or is available for download from ( http://netcat.sourceforge.net/ ). Students will also use the Wireshark protocol analyzer to inspect network traffic generated by the network application. Wireshark is preinstalled on laboratory virtual machines but is also available for download from ( https://www.wireshark.org/ ).

Instructions:

1. Log into the IT/CS780 Ubuntu virtual machine. Credentials for the virtual machine follow: a. Username: *(note the display name is 780root, but this is the “nick name” of the account, not the name students will use to authenticate.) b. Password: 1337@^)) *(this is essentially 1337 2600)

2. Open the folder named “socket_programming_lab”:

3. Right-click on whitespace within the “socket_programming_lab” folder and select “Open in Terminal”.

4. Type “ls -l” to view file properties and verify that the “lab_03_web_server.sh” script has permission to be executed (this is indicated by the “x” characters to the left of the file name, as well as the filename being displayed in green text).

5. Start the webserver program by typing the “./lab_03_web_server.sh” . Alternatively, you should be able to use “tab completion” by pressing the “tab” key after typing the first letter of the file name e.g. after typing “./l” (note, the period “.” Character is necessary to execute the program unless you the entire to the file).

6. Verify a folder named “www” was created within the “socket_programming_lab” folder and that files named “lab3.html” and “www_fifo” were also created in the “www” folder.

7. Click on the “Wireshark” icon to launch the Wireshark protocol analyzer.

8. [1] Click on the “Loopback:lo” interface, then [2] click on the start capture icon.

9. Right-click on the “terminal” icon and select “New Terminal” to open another terminal window (note, one terminal window should be open running the web server. DO NOT attempt to use the webserver window to enter commands.)

10. Within the new terminal window type the command “ -antop” . Review the output of the netstat socket table and identify the entry associated with TCP port 8080. Note the state of the connection.

11. Click on the “Firefox Web browser”.

12. Enter the url http://localhost:8080/lab3.html . A website similar to the one below should be generated. If a web page does not generate, then proceed to step 12.b , you may need to restart the webserver.

12.b (Note this is only necessary if the following error generates). If you see this error, proceed to step 12.c

12.c Click on the terminal window that is running the webserver program. [1]Type “ctrl+C” to terminate the current webserver process. [2] Press the “up” arrow key on the key board to automatically retype the last command or manually retype the command to launch the webserver program, press enter to execute the command.

12.d Click on the Firefox web browser window and [1] click on the “reload” button to send a new page request to the server. Verify the page loads properly in accordance with the screen capture below.

13. Click on the Wireshark application to view the current packet capture. [1] Select and right-click one of the packets that has the “HTTP” string listed in the “protocol” column. [2] Hover over the “Follow” option and [3] select the “HTTP Stream” option.

14. A window similar to the following screen capture should appear. This window represents the data passed between the client and server programs. In this scenario the Firefox application is the client and the webserver script is acting as the server. Client data is represented in red text, and server data is represented in blue text. Compare this HTTP message exchange with the standards defined in RFC 7230.

15. Click on the terminal window used to issue the “netstat” command previously. Retype the command “netstat -antop” and review any notable differences from the previous output.

16. Navigate to the “socket_programming_lab” and [1] right-click on the “lab_03_web_server.sh” file and [2] select “Open with gedit”.

17. Review the source code of the webserver script to gain insight to its functionality.

18. This concludes the lab. Please complete the check on learning questions. Check on Learning:

1. (3 points) This exercise demonstrated how the Netcat program may be used to construct a rudimentary web server. How else might the netcat program be used? (Hint: leverage online resources to research the answer. Possible sources include: https://linux.die.net/man/1/nc ; https://en.wikipedia.org/wiki/Netcat ). Provide least 3 uses of the Netcat program.

2. (2 points) Which section(s) of the RFC document are necessary to reference when constructing HTML Messages to implement a simple client server program? (ans: section 2.1 Client/Server Messaging ; Section 3 Message )

3. (2 point) The default configuration for some webservers is to use the /var/www directory to host webpages. Can this directory be changed?

4. (2 points) The default port used to host webpages is TCP port 80. Can this be changed? How do you know?

5. (2 points) Does the webserver script in this exercise conform to the standards outlined in RFC 7230? If not, where does it differ?

6. (2 points) What evidence exists within the socket table produced by the Netstat command to indicate the webserver program is running?

7. (2 points) Identify something (feature, functionality, capability etc.) defined within RFC 7230 that is not implemented by the sample program provided. Describe what this feature does and how it is useful to webservers or clients. You do not need to code this feature, or modify the existing program. This question is intended to familiarize you with extracting information from RFC documents.