Using the Wireshark Packet Dissector
#Overview
We’ve written 2 Lua script plugin for Wireshark that helps dissect packets defined in the Project 1 spec and Project 2 spec. They are useful for:
- Verifying that packet fields are correctly aligned and assigned.
- Ensuring you are sending the expected data to the reference implementation.
- Comparing field values with those from the reference implementation.
#Installation
#Update the Helper Script
Note: this is not needed for Project 2; the capture code is already in the main branch.
First, pull the capture
branch. If you cannot pull it, just copy the helper
script instead.
This version of the helper
script has a new command that can run a test case while performing packet capture.
#Install Wireshark
Download and install Wireshark by following the instructions here.
#Install the Lua Script Plugin
Once Wireshark is installed, follow these steps to install the dissector plugin:
- Download the Project 1 Lua script or the Project 2 Lua script.
- Open Wireshark.
- Open the “About Wireshark” dialog:
- On Linux/Windows: Go to Help → About Wireshark.
- On macOS: Go to Wireshark → About Wireshark.
- Navigate to the Folders tab.
- Double-click the entry for Personal Lua Plugins.
- Copy the downloaded script into this folder.
- Press
Ctrl+Shift+L
to refresh the plugins.
For reference, see the original instructions here.
#Usage Example
- Run the autograder using the
helper
script with thecapture
command.capture
command takes the same argument as thetest
command. For example, run./helper capture handshake all
to run allhandshake
tests. - After execution, in your
dumps
folder, you should have a file namedfile-xxxx-testcase-name.pcap
. - Open this file with wireshark and you can look at the capture of your packets.
Each test case typically uses a new port. To filter packets for individual tests, use the following Wireshark filter:
!dns && (udp.srcport == 8081 || udp.dstport == 8081)
This will exclude DNS traffic and focus on packets relevant to your tests.