Skip to content
Tutorials Center
My learning

Topics

Lesson 32 of 37 ยท Advanced Techniques

Profiles, Coloring Rules, Custom Columns and Lua Dissectors

Customize Wireshark for different jobs: configuration profiles, coloring rules, custom columns, display filter macros and a first Lua dissector for a custom protocol.

Out of the box, Wireshark is general-purpose. Daily work becomes much faster when it is tuned to the task: a profile for web debugging, another for VoIP, another for security reviews. This lesson shows how to customize the interface and then teach Wireshark a protocol it does not know using a small Lua dissector.

Wireshark is a desktop application and cannot run here, so configuration is shown as read-only text. The Lua code is a small, real dissector, but it cannot run in the browser. A Python stand-in demonstrates the same parsing logic so you can run and test it.

Configuration profiles

A profile is a folder of settings: columns, colors, filters, preferences, window layout. Switch with the profile name in the status bar, or Edit, then Configuration Profiles. Good ideas:

  • Default-clean: untouched, for comparison.
  • Web: columns for http.host, http.request.uri, http.response.code.
  • Latency: columns for tcp.analysis.ack_rtt and frame.time_delta_displayed.
  • DNS: columns for dns.qry.name, dns.flags.rcode, dns.time.

Profiles live in your user configuration folder, so you can copy them to another computer or share with a team.

Custom columns

Right-click a field in the details pane and choose "Apply as Column". Or in Preferences, Appearance, Columns, add a column of type "Custom" with a display filter field as its value, for example tcp.stream. A column can show several fields separated by || (the first non-empty one is displayed), for example dns.qry.name || http.host || tls.handshake.extensions_server_name gives one "Hostname" column that works across three protocols.

Coloring rules

View, then Coloring Rules lists display filters with colors. Packets matching a rule take its colors, so issues stand out visually. You can add your own:

Name Filter Use
Slow DNS dns.time > 0.5 Orange background
Resets tcp.flags.reset == 1 Red text
Internal scanner ip.src == 10.0.0.99 Purple
Guest VLAN vlan.id == 30 Light blue

Order matters: the first matching rule wins, so put narrow rules above broad ones. Temporary rules via right-click, "Colorize Conversation", are quick for one session.

Display filter macros and buttons

Edit, Preferences, Filter Buttons adds one-click buttons ("Retransmissions", "DNS errors"). Display Filter Macros (Analyze menu) lets you define reusable filter pieces like ${lan} that expands to ip.addr == 10.0.0.0/24 || ip.addr == 192.168.0.0/16.

Why write a dissector?

Wireshark knows thousands of protocols, but a company's own application protocol, or an experimental one you are building, is just "Data". A dissector parses those bytes and shows named, filterable fields. Dissectors can be written in C, but Lua is the easy route: no compiler, load a script at startup.

Imagine a tiny protocol "PING1" over UDP port 9999:

Offset Size Field
0 1 version
1 1 message type (1 = request, 2 = reply)
2 2 sequence number (big-endian)
4 n text payload
LUA
-- ping1.lua : save in your Wireshark plugins folder
local ping1 = Proto("ping1", "Example PING1 Protocol")

local f_version = ProtoField.uint8("ping1.version", "Version")
local f_type    = ProtoField.uint8("ping1.type", "Type", base.DEC,
                                   { [1] = "Request", [2] = "Reply" })
local f_seq     = ProtoField.uint16("ping1.seq", "Sequence")
local f_text    = ProtoField.string("ping1.text", "Text")
ping1.fields = { f_version, f_type, f_seq, f_text }

function ping1.dissector(buffer, pinfo, tree)
  if buffer:len() < 4 then return end
  pinfo.cols.protocol = "PING1"
  local subtree = tree:add(ping1, buffer(), "PING1 Protocol")
  subtree:add(f_version, buffer(0, 1))
  subtree:add(f_type,    buffer(1, 1))
  subtree:add(f_seq,     buffer(2, 2))
  if buffer:len() > 4 then
    subtree:add(f_text, buffer(4))
  end
end

DissectorTable.get("udp.port"):add(9999, ping1)

After restarting Wireshark (or Analyze, Reload Lua Plugins), packets on UDP port 9999 show a PING1 tree, and you can filter with ping1.type == 2 or ping1.seq > 100.

Main parts: Proto registers the protocol, ProtoField declares fields (name used in filters, label, type), dissector reads bytes with buffer(offset, length) and adds items to the tree, and DissectorTable tells Wireshark when to call it.

Test the logic first

Before debugging inside Wireshark, check your understanding of the layout by writing the same parser in a language that runs anywhere.

Python Stand-in: decode PING1 messages in Python

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Python Stand-in: apply a display filter like ping1.type == 2

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Safe plugin habits

  • Lua scripts run with your privileges. Load scripts only from sources you trust and read them first.
  • Keep dissectors defensive: check buffer:len() before reading, never assume well-formed data.
  • Put scripts in the personal plugins folder (Help, About Wireshark, Folders shows the path).
  • Version your profiles and scripts in Git so a team can share them.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does a Wireshark profile store?

    Profiles bundle configuration so you can switch setups for different tasks.
  2. 2. In coloring rules, which rule takes effect when a packet matches several?

    Rules are checked top to bottom and the first match applies, so order is important.
  3. 3. What is the purpose of a Lua dissector?

    A dissector turns raw bytes into structured, filterable fields.
  4. 4. Why should you load Lua scripts only from trusted sources?

    A malicious script could read files or run commands as you.

Summary

  • Profiles, columns, coloring rules and filter buttons tune Wireshark to each job.
  • A custom column can combine fields from several protocols into one.
  • A Lua dissector declares fields, parses bytes with buffer(offset, length), and registers on a port.
  • Prototype parsing logic first, and treat third-party scripts as code to review.

Next: Large Captures and Ring Buffers