Ask Your Question
0

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

asked 2018-08-09 03:43:10 +0000

Ken.C gravatar image

updated 2018-08-09 03:43:54 +0000

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?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-08-09 16:15:38 +0000

cmaynard gravatar image

updated 2018-08-10 13:30:23 +0000

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.

edit flag offensive delete link more

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 gravatar imageKen.C ( 2018-08-10 02:21:24 +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

1 follower

Stats

Asked: 2018-08-09 03:43:10 +0000

Seen: 1,996 times

Last updated: Aug 10 '18