

Voila`, you're now decoding DNS packets using the simplistic dissector in this script. If you have a capture file with DNS packets in it, simply select one in the Packet List pane, right-click on it, and select "Decode As …", and then in the dialog box that shows up scroll down the list of protocols to one called "MYDNS", select that and click the "ok" or "apply" button. How to use this script: Once the script is loaded, it creates a new protocol named "MyDNS" (or "MYDNS" in some places). We also have other example Lua scripts, but the nice thing about this one is getting capture files to run it against is trivial. The goal isn't to fully dissect DNS properly - Wireshark already has a good DNS dissector built-in. It's neither comprehensive nor error-free with regards to the DNS protocol. This script creates an elementary dissector for DNS. If you wonder why some functions are called some way, or differently than previous invocations of the same function: the reason is its trying to to show both that it can be done numerous ways, but also trying to test those numerous ways. To test various functions being called in various ways, so this script can be used in the test-suites.To provide a reference tutorial for others writing Wireshark dissectors in Lua.The script is too long to embed in this page, and it's much better to view it in a text editor that supports Lua syntax highlighting, because there are a lot of comments in the script explaining things. Tutorial scripts A dissector tutorial scriptĭownload this a file for an example Lua script for a protocol dissector. Create new data (tvb) with ByteArray and Struct.

Using Lua to register protocols to more ports.A custom file reader & writer tutorial script.A dissector tutorial with TCP-reassembly.
