WireShark xPL dissector; a network protocol analyzer

I’ve recently turned to WireShark to do some network analysis but found tracking the bits and bytes of xPL not too easy, though still not difficult. But when I read that WireShark can be extended using Lua, I started fiddling around with that to see how I could get xPL support in WireShark. And this post is about the results…

The ‘dissector’ I wrote (download is below) will examine xPL packets, and dissect them into the underlying components. This allows you to use WireSharks filtering capabilities to find just the xPL messages you need. Beyond that it will analyze the structure of the messages received and validate that against the xPL protocol, flagging any malformed messages.

Below a short tutorial how to go about to do some xPL filtering and validation by using WireShark

[ad name=”468×60 Banner”]

Installation

Obviously you need to install WireShark, using the defaults will do. Download the dissector (link is at the bottom) and get the .lua file from the zip file. The .lua file is the  most important file as it contains the dissector itself. Copy the .lua file to the WireShark plugin directory, depending on the OS it might be different, I did it on WinXP at C:\Program Files\Wireshark\plugins\1.4.6\. If you had WireShark started already, you need to restart it. That’s all there is to it.

About WireShark

The tough part in network analysis is the tremendous amount of data going over a network. The challenge is to find the needle in the haystack. For this purpose WireShark uses filtering and it does so at 2 levels; capture and display.

Filtering at capture simply means that it will only record, or store, the data that passes the filter. Any data that is not captured because it didn’t pass the filter is lost forever (from the analysis at least that is).

Filtering at display allows you to further zoom in into the data collected, without losing data. By broadening the display filter you can make packets not shown reappear.

Using WireShark with xPL

Capturing data

Open the capture options dialog and enter “udp port 3865” in the “capture filter” textbox, this will capture only UDP traffic in/out at port 3865 (the xPL port). Make sure the correct network interface is selected and then click Start at the bottom of the dialog.

Filtering

In the main screen, click the “Expression…” button right of the filter textbox. In the tree open the Field name at XPL, here you’ll find the different xPL message fields that can be used for filtering.

Playing around

Open the xpl_dissector_testdata.pcap file (included in the downloadable zip file below) with WireShark, it contains test data with numerous xPL messages, mostly faulty messages as it was generated with the (also included) test generator. Select a package in the top part of the window and then expand the tree below where it says “xPL Protocol, Src: …..“. In most cases this line will be red which indicates its a faulty message, browse through the tree to see what kind of feedback the dissector gives on faulty messages. For each of the test messages in the capture file the first key-value pair contains the error (that was on purpose added) in the message.

WireShark with faulty test messages

[ad name=”468×60 Banner”]

Some notes

Because its coded in lua script, the dissector is not as fast as the built-in dissectors. Especially as it does validate every message quite extensively. xPL is not very bandwidth intense, so this should not be an issue, but in sporadic cases it might be. Consider to capture the data first with the dissector disabled and save the data. Then later reopen the saved file with the dissector enabled to perform your analysis.

Download

The download is a single zip file with all the supporting materials included (downloaded 1078 times).

Be Sociable, Share!

3 thoughts on “WireShark xPL dissector; a network protocol analyzer

  1. Hello Thijs, it seems the dissector under MAC OSX 10.6 / Wireshark 1.6.5 will not load. The error displayed is:

    Lua: syntax error during precompilation of `/Users/janno/.wireshark/plugins/xpl_dissector.lua’:
    [string “/Users/janno/.wireshark/plugins/xpl_dissector.lua”]:1: ‘=’ expected

    What do you think, is there any hope for OSX?

    • Looks like a syntax error on line 1. Have you verified the contents? the first line should only be; –[[ (double dash, double block open) which is the start of a multiline comment in Lua. If the file is OK, then you might try to convert lineendings in the Lua file (plain text), which are probably windows (CRLF), to either CR or LF only (whatever is the proper Mac format).

Leave a Reply

Your email address will not be published. Required fields are marked *

 

Subscribe without commenting