Wireshark/HTTP

From Wikiversity
Jump to navigation Jump to search

Wireshark is a free and open source packet analyzer used for network troubleshooting and analysis. These activities will show you how to use Wireshark to capture and analyze Hypertext Transfer Protocol (HTTP) traffic.

Readings[edit | edit source]

Preparation[edit | edit source]

To prepare for this activity:

  1. Start Windows.
  2. Log in if necessary.
  3. Install Wireshark.

Activity 1 - Capture HTTP Traffic[edit | edit source]

To capture HTTP traffic:

  1. Open a new web browser window or tab.
  2. Search the Internet for an http (rather than https) website.
  3. Start a Wireshark capture.
  4. Navigate to the website found in your search.
  5. Stop the Wireshark capture.

Activity 2 - Select Destination Traffic[edit | edit source]

To select destination traffic:

  1. Observe the traffic captured in the top Wireshark packet list pane. To view only HTTP traffic, type http (lower case) in the Filter box and press Enter.
  2. Select the first HTTP packet labeled GET /.
  3. Observe the destination IP address.
  4. To view all related traffic for this connection, change the filter to ip.addr == <destination>, where <destination> is the destination address of the HTTP packet.

Activity 3 - Analyze TCP Connection Traffic[edit | edit source]

To analyze TCP connection traffic:

  1. Observe the traffic captured in the top Wireshark packet list pane. The first three packets (TCP SYN, TCP SYN/ACK, TCP ACK) are the TCP three way handshake. Select the first packet.
  2. Observe the packet details in the middle Wireshark packet details pane. Notice that it is an Ethernet II / Internet Protocol Version 4 / Transmission Control Protocol frame.
  3. Expand Ethernet II to view Ethernet details.
  4. Observe the Destination and Source fields. The destination should be your default gateway's MAC address and the source should be your MAC address. You can use ipconfig /all and arp -a to confirm.
  5. Expand Internet Protocol Version 4 to view IP details.
  6. Observe the Source address. Notice that the source address is your IP address.
  7. Observe the Destination address. Notice that the destination address is the IP address of the HTTP server.
  8. Expand Transmission Control Protocol to view TCP details.
  9. Observe the Source port. Notice that it is a dynamic port selected for this HTTP connection.
  10. Observe the Destination port. Notice that it is http (80). Note that all of the packets for this connection will have matching MAC addresses, IP addresses, and port numbers.

Activity 4 - Analyze HTTP Request Traffic[edit | edit source]

To analyze HTTP request traffic:

  1. Observe the traffic captured in the top Wireshark packet list pane.
  2. Select the fourth packet, which is the first HTTP packet and labeled GET /.
  3. Observe the packet details in the middle Wireshark packet details pane. Notice that it is an Ethernet II / Internet Protocol Version 4 / Transmission Control Protocol / Hypertext Transfer Protocol frame. Also notice that the Ethernet II, Internet Protocol Version 4, and Transmission Control Protocol values are consistent with the TCP connection analyzed in Activity 3.
  4. Expand Hypertext Transfer Protocol to view HTTP details.
  5. Observe the GET request, Host, Connection, User-Agent, Referrer, Accept, and Cookie fields. This is the information passed to the HTTP server with the GET request.
  6. Observe the traffic captured in the top Wireshark packet list pane.
  7. Select the fifth packet, labeled TCP ACK. This is the server TCP acknowledgement of receiving the GET request.

Activity 5 - Analyze HTTP Response Traffic[edit | edit source]

To analyze HTTP response traffic:

  1. Observe the traffic captured in the top Wireshark packet list pane.
  2. Select the second HTTP packet, labeled 301 Moved Permanently.
  3. Observe the packet details in the middle Wireshark packet details pane.
  4. Expand Hypertext Transfer Protocol to view HTTP details.
  5. Observe the HTTP response, Server, Expires, Location, and other available information. This response indicates that the requested page has permanently moved to the location provided.
  6. Observe the traffic captured in the top Wireshark packet list pane.
  7. Select the next packet, labeled TCP ACK. This is the client TCP acknowledgement of receiving the HTTP response.

Activity 6 - Analyze HTTP Request Traffic[edit | edit source]

To analyze HTTP request traffic:

  1. Observe the traffic captured in the top Wireshark packet list pane.
  2. Select the third HTTP packet, labeled GET /wiki/Wikiversity:Main_Page.
  3. Observe the packet details in the middle Wireshark packet details pane.
  4. Expand Hypertext Transfer Protocol to view HTTP details.
  5. Observe the HTTP request fields. Notice that the request is similar to the request in Activity 4 above, except that the new page location is requested.
  6. Observe the traffic captured in the top Wireshark packet list pane.
  7. Select the next packet, labeled TCP ACK. This is the server TCP acknowledgement of receiving the GET request.

Activity 7 - Analyze HTTP Response Traffic[edit | edit source]

To play HTTP response traffic:

  1. Observe the traffic captured in the top Wireshark packet list pane.
  2. Select the next packet, labeled TCP segment of a reassembled PDU. Notice that because the server response is longer than the maximum segment PDU size, the response has been split into several TCP segments.
  3. Observe the packet details in the middle Wireshark packet details pane.
  4. Observe the packet contents in the bottom Wireshark packet bytes pane.
  5. Observe the traffic captured in the top Wireshark packet list pane. Notice that for every two TCP segments of data, there is a TCP ACK acknowledgement of receiving the HTTP response.
  6. Select the last HTTP packet, labeled HTTP 200 OK.
  7. Observe the packet details in the middle Wireshark packet details pane. Notice the Reassembled TCP Segments listed.
  8. Expand Hypertext Transfer Protocol to view HTTP details.
  9. Observe the full HTTP response to be passed to the web browser.
  10. Expand Line-based text data to observe web page content.
  11. In the web browser, right-click on the web page and view the page source. Notice that it is identical to the line-based text captured in Wireshark.
  12. Close the web browser.
  13. Close Wireshark to complete this activity. Quit without Saving to discard the captured traffic.

References[edit | edit source]