Ask Your Question

Revision history [back]

Lua get_filter in 3.2.7

Hello! I’m writing a script that uses the get_filter function, but it doesn’t seem to be working the way I expect in Wireshark 3.2.7. When I run this script, the string returned by get_filter is empty:

local function get_display_filter()
  if get_filter then
    local e = get_filter()
    return "Current filter: '" .. e .. "' (length " .. string.len(e) .. ")"
  end
end

local function test()
  set_filter("ip.addr == 0.0.0.0")
  apply_filter()
  local splash = TextWindow.new("Test get_filter");
  splash:append(get_display_filter())
end

-- Should say "Current filter: 'ip.addr == 0.0.0.0' (length 18)"
test()

I also tried running this in Wireshark 2.6.20, and it worked as expected there. Is my code missing something?

(To run this in both versions, I went to Tools > Lua > Evaluate, pasted my script, and ran it)