First time here? Check out the FAQ!
THIS IS A TEST INSTANCE. Feel free to ask and answer questions, but take care to avoid triggering too many notifications.
0

BinDecHex.lua: Error - bad argument to module(..., package.seeall);

Hello, I am having trouble setting wireshark to read OMCI package in Ubuntu 18.04. I was trying to use the https://github.com/antran-ptit/omci-w... omci.lua and BinDecHex.lua to read OMCI package, which was suggested by Wireshark contribute wiki (https://wiki.wireshark.org/Contrib).

I tried to copy these two files into the my global wireshark lua folder

/usr/lib/x86_64-linux-gnu/wireshark/plugins

and then adding the line

dofile(DATA_DIR.."omci.lua")

in my init.lua.

While running the omci-example.pcap, I received the following 2 error:

[string "/usr/lib/x8664-linux-gnu/wireshark/plugins/o..."]:43: module 'BinDecHex' not found: no field package.preload['BinDecHex'] no file '/usr/local/share/lua/5.2/BinDecHex.lua' no file '/usr/local/share/lua/5.2/BinDecHex/init.lua' no file '/usr/local/lib/lua/5.2/BinDecHex.lua' no file '/usr/local/lib/lua/5.2/BinDecHex/init.lua' no file '/usr/share/lua/5.2/BinDecHex.lua' no file '/usr/share/lua/5.2/BinDecHex/init.lua' no file './BinDecHex.lua' no file '/usr/local/lib/lua/5.2/BinDecHex.so' no file '/usr/lib/x8664-linux-gnu/lua/5.2/BinDecHex.so' no file '/usr/lib/lua/5.2/BinDecHex.so' no file '/usr/local/lib/lua/5.2/loadall.so' no file './BinDecHex.so'

Lua: Error during loading: [string "/usr/lib/x86_64-linux-gnu/wireshark/plugins/B..."]:53: bad argument #1 to 'module' (string expected, got nil)

Appearently the BinDecHex.lua doesn't recognize the module(...,package.seeall)? Any idea how to solve this problem?

Ken.C's avatar
3
Ken.C
asked 2018-08-09 03:43:10 +0000, updated 2018-08-09 03:43:54 +0000
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

0

First, you don't need to add the dofile(DATA_DIR.."omci.lua") to init.lua.

The 2 Lua files were written long ago and BinDecHex.luarequires at least the following 2 tweaks to work now, which I've made and uploaded back to the https://wiki.wireshark.org/Contrib page.

Change line 53 from:

module(..., package.seeall);

To:

module("BinDecHex", package.seeall);

The module function is deprecated as of Lua 5.2, as mentioned in section 8 of the Lua 5.2 Reference Manual - Incompatibilities with the Previous Version.

And change line 135 from:

for i in string.gfind(s, ".") do

to:

for i in string.gmatch(s, ".") do

Function string.gfind was renamed string.gmatch, as mentioned in section 7.2 of the Lua 5.1 Reference Manual - Changes in the Libraries.

Wireshark currently ships with Lua 5.2.4 (on Windows), so always use the Lua 5.2 Reference Manual when writing or dealing with Lua dissectors.

cmaynard's avatar
11.1k
cmaynard
answered 2018-08-09 16:15:38 +0000, updated 2018-08-10 13:30:23 +0000
edit flag offensive 0 remove flag delete link

Comments

Thanks alot! I didn't realize you don't need to add dofile(DATA_DIR.."omci.lua") anymore. Most of all, that module("BinDecHex", package.seeall); was the piece I couldn't figure out. Again, Thanks!

Ken.C's avatar Ken.C (2018-08-10 02:21:24 +0000) edit
add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer