Wireshark-dev: Re: [Wireshark-dev] running a lua function via tshark

From: Tony Trinh <tony19@xxxxxxxxx>
Date: Sun, 15 Jan 2012 11:31:59 -0500
On Sun, Jan 15, 2012 at 11:04 AM, Maayan Zadik <maayanz@xxxxxxxxxxxxxxxxxxxxx> wrote:

I have a lua script range_check.lua

It has a function range_check(), which checks the ranges of the fields of each packet in a pcap file, and it is registered to the menu “MENU_TOOLS_UNSORTED”

 

I tried running:

tshark -X lua_script:range_check.lua -q -r my_capture.pcap

but “-X lua_script:range_check.lua” just loads reange_check, it does no run the function “range_check()” on the pcap.

 

Is there a way to run “range_check()“on a given pcap file via tshark?


I'm guessing the Listener/Tap is only registered in the menu callback. In TShark, you want the tap to auto-register. If you're indeed doing this already, please provide a snippet. 

Your script should check gui_enabled() (or the variable GUI_ENABLED) to determine whether the tap registration should occur by menu or automatically (see similar example).