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

How do I setup Wireshark to run Lua’s CLRPackage

1
1

I'm trying to setup Wireshark so that I can use the LuaInterface to use some of the classes in the .NET framework. I'm able to get it working running through the Lua command line, but when I try to require "CLRPackage" in the init.lua startup script, it doesnt appear to find the required files. I get the following exception when starting Wireshark:

Lua: Error during loading:
 C:\Program Files\Wireshark\luascript.lua:25: module 'CLRPackage' not found:
    no field package.preload['CLRPackage']
    no file '.\CLRPackage.lua'
    no file 'C:\Program Files\Wireshark\lua\CLRPackage.lua'
    no file 'C:\Program Files\Wireshark\lua\CLRPackage\init.lua'
    no file 'C:\Program Files\Wireshark\CLRPackage.lua'
    no file 'C:\Program Files\Wireshark\CLRPackage\init.lua'
    no file 'C:\Program Files\Lua\5.1\lua\CLRPackage.luac'
    no file '.\CLRPackage.dll'
    no file '.\CLRPackage51.dll'
    no file 'C:\Program Files\Wireshark\CLRPackage.dll'
    no file 'C:\Program Files\Wireshark\CLRPackage51.dll'
    no file 'C:\Program Files\Wireshark\clibs\CLRPackage.dll'
    no file 'C:\Program Files\Wireshark\clibs\CLRPackage51.dll'
    no file 'C:\Program Files\Wireshark\loadall.dll'
    no file 'C:\Program Files\Wireshark\clibs\loadall.dll'

I've tried setting the package.path and package.cpath to match what is set at the command line, but that doesnt seem to help.

package.path = ";.\\?.lua;C:\\Program Files\\Lua\\5.1\\lua\\?.lua;C:\\Program Files\\Lua\\5.1\\lua\\?\\init.lua;C:\\Program Files\\Lua\\5.1\\?.lua;C:\\Program Files\\Lua\\5.1\\?\\init.lua;C:\\Program Files\\Lua\\5.1\\lua\\?.luac;C:\\Program Files\\Lua\\5.1\\lua\\?lua"

package.cpath = package.cpath .. ".\?.dll;.\?51.dll;C:\Program Files\Lua\5.1\?.dll;C:\Program Files\Lua\5.1\?51.dll;C:\Program Files\Lua\5.1\clibs\?.dll;C:\Program Files\Lua\5.1\clibs\?51.dll;C:\Program Files\Lua\5.1\loadall.dll;C:\Program Files\Lua\5.1\clibs\loadall.dll;C:\Program Files\Lua\5.1\clibs\luanet.dll"

When I do this, I get the following error:

Lua: Error during loading:
error loading module 'luanet' from file
'C:\Program Files\Lua\5.1\clibs\luanet.dll':
The spcecified module could not be found.

This is a strange error since the file definitely exists.

I’ve installed the Lua package for windows in C:\Program Files\Lua\5.1.

Has anyone been able to get this working? Any help would be appreciated.

I’m using Wireshark 1.4.4 with Lua 5.1.4 I downloaded luaforwindows from here. It’s version 5.1.4-45

Microsoft Windows XP Professional Version 2002 Service Pack 3

asked 25 Aug ‘11, 07:15

SwDevMan81's gravatar image

SwDevMan81
363612
accept rate: 50%

edited 06 Sep ‘11, 10:04


One Answer:

3

Your Wireshark is old. The current stable release is Wireshark 1.6.1.

Wireshark already includes Lua. You don't need to install your own copy of Lua because Wireshark comes with its own Lua interpreter (and will only use its own). However, your Wireshark Lua scripts can still call the libraries installed by LuaForWindows.

LuaInterface 1.5.3 is probably incompatible. LuaForWindows v5.1.4-45 ships with LuaInterface 1.5.3, which might be incompatible with your Wireshark installation (exhibited by runtime error R6034 upon loading luanet.dll). This was true for me with Wireshark 1.6.1 on Windows 7. You can get compatible binaries of LuaInterface 2.0.3 from this ticket.

Instructions

1) Copy the VS2005 SP1 Redistributables from LuaForWindows to Wireshark's program directory (or you can download the redist package from Microsoft...see ticket):

From:

  • %PROGRAMFILES%\Lua\5.1\install\support\Microsoft.VC80.CRT.SP1\Microsoft.VC80.CRT.manifest
  • %PROGRAMFILES%\Lua\5.1\install\support\Microsoft.VC80.CRT.SP1\msvcm80.dll
  • %PROGRAMFILES%\Lua\5.1\install\support\Microsoft.VC80.CRT.SP1\msvcp80.dll
  • %PROGRAMFILES%\Lua\5.1\install\support\Microsoft.VC80.CRT.SP1\msvcr80.dll

To:

  • %PROGRAMFILES%\Wireshark\Microsoft.VC80.CRT.manifest
  • %PROGRAMFILES%\Wireshark\msvcm80.dll
  • %PROGRAMFILES%\Wireshark\msvcp80.dll
  • %PROGRAMFILES%\Wireshark\msvcr80.dll

2) Download LuaInterface 2.0.3 ZIP from this ticket, and copy the following from it:

From:

  • ...\bin\Release\LuaInterface.dll
  • ...\bin\Release\luanet.dll

To:

  • %PROGRAMFILES%\Wireshark\clibs\LuaInterface.dll
  • %PROGRAMFILES%\Wireshark\clibs\luanet.dll

From:

  • ...\LuaInterface\lua\CLRForm.lua
  • ...\LuaInterface\lua\CLRPackage.lua

To:

  • %PROGRAMFILES%\Wireshark\lua\CLRForm.lua
  • %PROGRAMFILES%\Wireshark\lua\CLRPackage.lua

3) Restart Wireshark/TShark if already running.

4) OPTIONAL: From Wireshark, open menu Tools > Lua > Evaluate. In the textbox that appears, enter some sample code, and click Evaluate.

This should result in something like this:

screenshot

answered 25 Aug '11, 19:41

helloworld's gravatar image

helloworld
3.1k42041
accept rate: 28%

edited 25 Aug '11, 20:00

+1 @helloworld - Your answer was exactly what I need. Thanks so much for the quick response!

(26 Aug '11, 06:48) SwDevMan81

This solution will only work for Wireshark versions up to and including 1.11.2. In Wireshark 1.11.3, Lua was updated from 5.1 to 5.2 and doesn't support backward compatibility. For information on setting up the LuaInterface with Wireshark 1.11.3 and beyond with Lua 5.2, see here

(12 Feb '15, 05:53) SwDevMan81