| 1 | initial version |
While the original answer I provided does work, I've since realized there's a much simpler solution. Instead of working with the Tvb and converting each 24 byte portion of it to a string, simply get a ByteArray from the Tvb and then convert that to a string in one simple step.
For example:
wlanpost = Proto("WLANpost", "Append WLAN SSID to Info column")
-- Create a field extractor for the SSID
wlan_ssid_f = Field.new("wlan.ssid")
function wlanpost.dissector(tvb, pinfo, tree)
-- Extract all values for this field
local wlan_ssid_ex = wlan_ssid_f()
if wlan_ssid_ex then
pinfo.cols.info:append(" - SSID Len = " .. wlan_ssid_ex.len .. "; SSID = " ..
tostring(wlan_ssid_ex.range:bytes()))
end
end
register_postdissector(wlanpost)