This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

lua script for wireshark

0

Hi ,

I am trying to write the lua script ( 5.2.3) for windows . extension lua script for wireshark .

facing error in this line "local f_proto = ProtoField.uint8("multi.protocol","Protocol",base.DEC,vs_protos)"

attempt to index global 'base' (a nil value) . How to fix this issue ..??

regards, Beno

asked 11 Sep '14, 22:16

benok's gravatar image

benok
11112
accept rate: 0%

Which version of wireshark/tshark are you using ?

And how are you executing the script ?

I've tried this specific line in Evaluate Lua window Tools->Lua->Evaluate of my wireshark 1.12.0 and it worked that is it did not raise any errors.

(12 Sep '14, 05:09) izopizo

hi izopizo ,

I am using wireshark 1.12.0 , executing via wireshark init.lua ( added dofile( "test.lua" ) , the content on the test.lua is local p_multi = Proto("multi","MultiProto");

local vs_protos = { [2] = "mtp2", [3] = "mtp3", [4] = "alcap", [5] = "h248", [6] = "ranap", [7] = "rnsap", [8] = "nbap" }

local f_proto = ProtoField.uint8("multi.protocol","Protocol",base.DEC,vs_protos)

(12 Sep '14, 05:22) benok

One Answer:

0

Where in init.lua did you put your "dofile(test.lua)" statement? I ask because the "base" table it's complaining about being a nil value is a Lua table defined in init.lua itself, at line 448 (or around there). So if you call "dofile(test.lua)" in init.lua before the base table is defined, you'll get that error.

The best thing to do would be to not call dofile() to load your test.lua file, but instead put test.lua in your personal plugins directory and Wireshark will automatically load it.

answered 12 Sep '14, 07:33

Hadriel's gravatar image

Hadriel
2.7k2939
accept rate: 18%