On Mon, Mar 13, 2017 at 10:25:17PM +0000, Kunal Thakrar wrote: > My aim for my module is to create a web browser agnostic developer's > tools, similar to Chrome and Firefox. When a user opens my module they > will see all the current TCP conversations occurring on their system > (this works in a similar way to the Conversation dialog). A user will > be able to choose a conversation. From there I want to be able to use > listeners to see all the packets to do with that conversation which > they selected on a new GUI window, and hopefully be able to implement > some sort of check whether there are HTTP or https packets etc. > > > In my previous email thread Peter Wu mentioned > > "The classes included with the WSLUA API are not designed to be > > registered with multiple users. If you are lucky, it sometimes does not > work as expected (due to shared global variables, registrations to other > parts of the dissector APIs), if you are unlucky it will just crash." > > Which seems to be the problem I am running into. So my question is, is > there a way to get around these problems with the Lua stack or would > it be easier to create/register listeners and post dissectors in C and > C++ and if it is, how would I go about doing it?
I think you can still use Lua as long as you load it through the "normal" methods (putting the Lua script in the plugins directory or using -Xlua_script:path/to/alert.lua). This will allow your Lua code to be executed as post-dissector or listener. Note that the Wireshark core will then invoke your Lua code, you should not call the Lua code from your C++ module. To trigger the post-dissector, I think your best chance will be invoking the redissection routines. Some grepping around points to something like MainWindow::redissectPackets (no idea whether it works for you, ymmv). If you have some functionality to expose to the Lua script, maybe you could register a class as usual (luaL_newmetatable, luaL_setfuncs, etc.), but you have to be careful to leave the Lua stack pointer unchanged. -- Kind regards, Peter Wu https://lekensteyn.nl ___________________________________________________________________________ Sent via: Wireshark-dev mailing list <[email protected]> Archives: https://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev mailto:[email protected]?subject=unsubscribe
