Wireshark-dev: Re: [Wireshark-dev] Lua embedded into C++
Hello,
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. I was going to do this all through using Lua scripts embedded into my GUI as it seems much easier to use WSLua as opposed to using C and C++ to create listeners (and or post dissectors).
Thanks to Pascal I was able to get this running, however, I did it in a slightly different way. Instead of using the WS_DLL_PUBLIC on the declare_wslua.h file (which compiled and built fine but did not register the functions to my Lua state). I instead used the same method of including ws_symbol_export.h in the wslua.h file and added WS_DLL_PUBLIC to the wslua_state() function which returned the state which Wireshark was using already (with all the Wireshark specific functions loaded into the state). This built and worked as expected - from here I should be able to use the Lua API to create the listeners etc.
Thank you two very much for taking the time out to reply!
Kind Regards, From: wireshark-dev-bounces@xxxxxxxxxxxxx <wireshark-dev-bounces@xxxxxxxxxxxxx> on behalf of Peter Wu <peter@xxxxxxxxxxxxx>
Sent: 01 February 2017 18:48 To: Developer support list for Wireshark Subject: Re: [Wireshark-dev] Lua embedded into C++ On Wed, Feb 01, 2017 at 06:38:52PM +0100, Pascal Quantin wrote:
> 2017-02-01 18:18 GMT+01:00 Kunal Thakrar <kunalthakrar@xxxxxxxxxxxxx>: > > > Hi Pascal, > > > > > > What I am trying to do is register the wslua functions in my Lua state in > > order to create my own scripts which will be used internally as part of my > > customised module. My module aims to use listeners and post dissectors to > > show information similar to google chrome and firefox's developer's tools > > and I feel more comfortable creating scripts using wslua as opposed to > > going straight through C and C++. > > > And as I explained, I cannot guarantee you that you have any chance to > have it working. We would need to get a feedback from the Wireshark > developers working on Lua. The classes includeed 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. If you are working in Lua, have you considered using the Lua API to create menu items and use a tap listener to process packets? Docs: https://www.wireshark.org/docs/wsdg_html_chunked/wsluarm_modules.html
https://www.wireshark.org/docs/wsdg_html_chunked/wslua_tap_example.html
If these APIs are too limiting for your purpose, or if you still want to invoke Lua from your scripts, perhaps you could try to clarify what you are trying to do? Maybe there is another way. -- Kind regards, Peter Wu https://lekensteyn.nl
___________________________________________________________________________ Sent via: Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx> Archives: https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe |
- References:
- Re: [Wireshark-dev] Lua embedded into C++
- From: Kunal Thakrar
- Re: [Wireshark-dev] Lua embedded into C++
- From: Pascal Quantin
- Re: [Wireshark-dev] Lua embedded into C++
- From: Peter Wu
- Re: [Wireshark-dev] Lua embedded into C++
- Prev by Date: Re: [Wireshark-dev] Lua embedded into C++
- Next by Date: [Wireshark-dev] Custom wireshark dissector plugin: unable to overwrite col_protocol and info
- Previous by thread: Re: [Wireshark-dev] Lua embedded into C++
- Next by thread: [Wireshark-dev] Sharkd warnings when built with VisualStudio 2015 64bit
- Index(es):