CS 725/825 Computer Networks, IT 725 Network Technology

Assignment 3


Due: Wednesday, November 1, 2023, 2:10 pm (start of the class)

Problems:

  1. (20 points) Using command line utility nc:
    1. Connect to a web server, send a well-formed GET request and capture the server's response. You can see an example of an HTTP request/response in Question 4 of Assignment 2. Briefly describe each line in the HTTP response. No need to analyze the document itself.
    2. Pretend to be a server and capture an HTTP request made by a browser. Briefly describe each line in the request.

    You are expected to look up the meaning of the header lines that were not discussed in the class but there is no need to go beyond one sentence. nc, a.k.a. netcat, is just one example of a utility that can be used. socat is another popular one. telnet can be used for the first part. Any tool/method that allows you to see the entire HTTP request and response is fine.

  2. (10 points) The goal of this exercise is to learn about HTTP redirects and to have you experiment with command line utility curl that is widely used for communication with web servers from scripts. It is also an excellent web protocol debugging tool. An alternative tool wget provides much of the same functionality.
  3. In this exercise you will explore the IMO clumsy way UNH’s main website handles redirection to HTTPS. Assume that a user types http://unh.edu in the address box of a browser. The UNH landing page gets displayed but the address bar now shows https://www.unh.edu. The question is how does this transition happen.

    Use curl, to see what you get when you try to retrieve http://unh.edu (this is similar to what was done in Question 4 of Assignment 2). You will need to instruct curl to show HTTP headers, tuning on its verbose mode is one way to do it. Instead of the page, you will get an HTTP redirect. Follow the redirects until you get the UNH page. Outline the steps you took and what information from one response you used to form the command used in the next step.

  4. (15 points) Analyze a trace of network traffic https://www.cloudshark.org/captures/8a5a445873a2 resulting from delivery of a simple email message and answer the following questions:
    1. Give the hostnames of the machines running the client and the server.
    2. What was the name of the application used to send the message?
    3. What was the name and version of the program used on the mail server?
    4. How did the server indicate the broad version of SMTP to be used?
    5. How did the client indicate that it agrees?
    6. Outline the MIME structure of the body of the message.
    7. The message contains an in-line attachment, what is the file type of the attachment?
    8. What is the content of the attachment (when it is displayed on the screen, what do you see)?
    9. Does the trace show a complete SMTP transaction? If not, why not?

    For each of your answers, indicate where/how you found it. Answering these questions will help you with the programming part of this assignment where you will be implementing a client capable of carrying out an equivalent protocol conversation with a real mail server.

  5. (5 points) File cs725-f23-a3-email.txt contains the raw email from the previous question as it was delivered to my UNH account. Take a look and answer the following questions.
    1. List the email servers were involved in the message delivery.
    2. While the message was not marked as a spam, there are some indications added by a spam checker in the message header. Can you point some out? What is the name of the spam checker?

Programming assignment:

  1. (50 points) The goal of this assignment is to have you implement from scratch a standard protocol. Study SMTP (the textbook has a good description, you can also look at RFC 5321 or Wikipedia article, which has a good example of a typical SMTP exchange). Problem 1 on this assignment should give another good example of an SMTP conversation. You are asked to implement a simple SMTP client in two different ways. Unlike the previous assignment, you are not allowed to use any libraries or tools that would allow you to send a message without actually implementing SMTP exchange.
  2. Technically, you can communicate with any mail server in this assignment, however, I would like to ask you to use the mail server running at berlioz.cs.unh.edu. This server is only accessible from UNH IP addresses. While there is nothing technically wrong with connecting to any mail server, typos-filled hand-typed sessions tend to trigger various security alarms. I have learned this the hard way when I assigned a similar question in the past and would like to avoid such problems this time around.

    Tasks

    1. Using nc and expect (or an equivalent tool) write as-short-as-possible script that delivers an email message by (partially) implementing SMTP conversation. You are not expected to do any extensive error checking. You are not allowed to use any command line utility for direct sending of an email (e.g., the mail command in Unix/Linux). Wikipedia article on expect provides a few examples to get you started. For this part of the programming assignment it is fine to hardcode the sender/recipient/subject/body in your program.
    2. Rewrite the solution from above using plain socket operations in a programming language of your choice. This time, you are expected to do elementary error checking (detecting an error, printing a message, and aborting the program is fine) and to allow for user-specified sender, recipient, subject and body of the message that is being sent. The exact user interface is up to you but you are not allowed to make the user type the SMTP commands. All you need to support is sending plain text messages, no need to implement sending attachments or any other fancy features.

    Deliverables

    1. Include a brief outline of the approach that you took and a sample run in your assignment submission. You must show representative runs of your programs together with appropriate explanations. Important: by showing an execution of your program, you are making a statement that your program, as submitted, works as shown. An attempt to "fake" a run, for example by writing a program that ignores input and just prints answers regardless of input, will be considered as cheating. You may be asked to give a demo of your program. If your program does not implement fully the required functionality or does not work, you have to make it clear in the report.
    2. Commit the source code to your course Git repository (see instructions). Add brief instructions on how to compile/run the code to the assignment's README.md. Do not commit data, graphs, documents, etc. into the repository. Don't forget to tag the commit as a3.

Submission instructions:

Upload your submission as a single PDF file using myCourses (mycourses.unh.edu). Any source code used in the assignment must be committed to the course Git repository. More details can be found in the standard assignment submission instructions.