Wireshark:PacketDissection
lastmod 2024-11-05created 2024-11-0111 edits
Wireshark Packet Dissection (dis-section).
Categories
Examples
- plcGateway#Wireshark Dissector - Packet analysis for the PLC communication middleware developed by Waidep.
LUA Script
First check whether Lua scripts are supported. Click "Help > About Wireshark" in the menu and check for "with Lua X.X.X".
Wireshark_-_About.png
Server packet analysis
See Tcpdump#Server packet analysis.
How to apply a script
First check the folder to upload scripts to. In the "Help > About Wireshark" menu, click the "Folders" tab to see the upload-related folders as follows.
Wireshark_-About-_Folders.png
If the folder does not exist, create it.
Write the script, copy it to that folder, then select "Analyze > Reload Lua Plugins" from the menu.
Wireshark_-Menu-Analyze-_Reload_Lua_Plugins.png
If there are already filtered packets, reloading takes quite a while.
Afterwards, the "Plugins" tab in the "Help > About Wireshark" menu shows the loaded lua scripts.
Wireshark_-About-_Plugins.png
You can also check by clicking "Analyze > Enabled Protocols" in the menu.
subtree
Setting endianness
Adding with the usual subtree:add adds it as Big-endian.
Adding with subtree:add_le adds it as Little-endian.
How to apply a filter
For example, when #Proto and #ProtoField are applied as follows:
local plcGateway_p2s_proto = Proto("plcGateway_p2s", "DDRM plcGateway PLC -> Server Packet")
local f_pass_no = ProtoField.uint16("plcGateway_p2s.pass_no", "Pass No", base.DEC)
local f_camera_no = ProtoField.uint16("plcGateway_p2s.camera_no", "Camera No", base.DEC, {
[1] = "Front Camber",
[3] = "Rear Camber",
[4] = "Front Turn",
[5] = "Rear Turn"
})
You can apply filters such as plcGateway_p2s or plcGateway_p2s.pass_no == 1.
How to register a default port
To add a #Proto to the tap port table, add it as follows. (You can add several if needed.
-- Register the dissector to TCP port
local tcp_table = DissectorTable.get("tcp.port")
tcp_table:add(30000, plcGateway_s2p_proto) -- Default to all TCP ports; adjust as needed (aaa)
tcp_table:add(30002, plcGateway_s2p_proto) -- Default to all TCP ports; adjust as needed (bbb)
See also
Favorite site
Guide
- Analyzing my own protocol with Wireshark (building a Wireshark Custom Dissector) : NHN Cloud Meetup
- (Wireshark) Developing a Message Dissector with Lua Script
- j2doll/wireshark-dissector-lua.kr: :kr: Wireshark analysis (from toast)
- (Script) Lua : Naver Blog
- How Kaillera handles game input - Kangssu’s programming world (includes a wireshark dissector sample for kaillera)