Ask Your Question
0

Lua get_filter in 3.2.7

asked 2021-01-27 23:02:25 +0000

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)

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2021-01-27 23:45:23 +0000

cmaynard gravatar image

That was my experience with get_filter() too; I couldn't get it to work either. My attempt concerned the tap-subnets.lua file attached to Issue 16795 in case you're curious.

In any case, I suspect this to be a bug, in which case you may want to file a Bug Report for it on the Wireshark Issue Tracker.

edit flag offensive delete link more

Comments

Glad it's not just me! Submitting a bug report is a good idea, I'll do that soon. Thanks!

rhodochrosiite gravatar imagerhodochrosiite ( 2021-01-28 00:48:27 +0000 )edit
1

Submitted a bug report here

rhodochrosiite gravatar imagerhodochrosiite ( 2021-01-28 18:00:31 +0000 )edit
1

Got lost in commit 63e437c0 which dropped displayFilterTextChanged()

Chuckc gravatar imageChuckc ( 2021-01-30 04:29:47 +0000 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2021-01-27 23:02:25 +0000

Seen: 65 times

Last updated: Jan 27