Ask Your Question

how to precompile and use precompiled lua dissectors

asked 2018-12-13 13:27:20 +0000

lazysloth gravatar image


i just finished writing my first small dissector. I'm impressed that i could do it within some hours without real LUA experience. I'm not a professional programmer, so copy pasting and adjusting stuff was my main method...

so... i could use luac to compile the final .lua script.

However: how do i use that piece now?

If i name the file "compiled_lua.lua" it fails because wireshark think it is plain/text lua. If i name it "luac" it is ignored If i leave the extension it is also ignored

I compiled it using "luac script.lua" ...

Before anyone interjects: i read 10 times now that it does not bring any performance benefits. The reason i'm doing this is mainly to be able to share it witout disclosing the source directly...

Thanks for any hints!

edit retag flag offensive close merge delete


I don't know if the GPL licence Wireshark is distributed under allows you to withhold the source of a Lua dissector if you distribute (as defined by the GPL) the "compiled" version. That's certainly not permissible for a C-based dissector.

grahamb gravatar imagegrahamb ( 2018-12-13 16:13:35 +0000 )edit

As per cmaynards comment it doesn't even seem to be possible right now. Anyway i had read about that GPL issue and it is the topic of many discussions. As far as i understood the GPL allows "private" code. I.e. if i share this only in my organization it would not be distributed in a broader manner and no distribution means no sharing of the source is necessary. But as i see, it is not possible anyway, so i'll live with the fact that my ugly code remains visible ;)

lazysloth gravatar imagelazysloth ( 2018-12-14 06:43:41 +0000 )edit

As for providing source code, that would be my understanding as well - that if you only distribute it within your own organization, then you don't have to release the source code outside of your organization. Basically, the same rules as for built-in or plugin C dissectors.

I find this feature potentially beneficial for a couple of reasons:

  1. Performance - Lua dissectors are definitely slower than C dissectors. Pre-compiling them could help with the performance.
  2. Support - If you distribute your pre-compiled Lua dissector to someone, then if they later report a problem with it, you know that they're running the same version as the one you distributed and not one that they've somehow potentially modified.

I wouldn't worry too much about your ugly code being visible to others in your organization though. Others can always provide feedback, fixes, recommendations, etc., and that's how you improve both the ...(more)

cmaynard gravatar imagecmaynard ( 2018-12-14 19:58:35 +0000 )edit

Well... sure... I understand and most important I appreciate the benefits of Open Source, I'll be happy to contribute to common knowledge. However i wrote the dissector on company time and hence must check the policy of whether i'm allowed to open source this piece of work or not. As i did not wanted to open pandoras box, i have not yet asked for approval. We're a huge corporation and i think finding out how to open source this might take as much or even more time than writing it... I'll check this in January after my christmas vacation.

lazysloth gravatar imagelazysloth ( 2018-12-18 11:28:28 +0000 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-12-13 15:56:19 +0000

cmaynard gravatar image

As far as I know, it isn't currently possible to use pre-compiled Lua scripts with Wireshark. If this is a feature you desire, you can file a Wireshark enhancement bug report asking for it to be implemented and perhaps one day it will be. You could even help its adoption by working on a solution yourself if you are so able.

edit flag offensive delete link more


Thanks. Well i'm not a professional software developer and glad that i even made this little LUA script work. I'll live with it then.

lazysloth gravatar imagelazysloth ( 2018-12-14 06:41:44 +0000 )edit

Well, that doesn't mean that someone else might find this useful too, so it can't hurt to file a bug report. If you don't file a bug report, then there's certainly less of a chance of such a feature ever being supported.

cmaynard gravatar imagecmaynard ( 2018-12-14 19:51:54 +0000 )edit

As per my comment to your other comment, i'll consider filing a bug report / feature request once i return to the office.

lazysloth gravatar imagelazysloth ( 2018-12-18 11:29:00 +0000 )edit

Bug 15391 has been filed.

cmaynard gravatar imagecmaynard ( 2019-01-03 19:45:12 +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


Asked: 2018-12-13 13:27:20 +0000

Seen: 792 times

Last updated: Dec 13 '18