开发者

How do I setup Wireshark to run Lua's CLRPackage

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 run开发者_如何学编程ning 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 received the help I needed over at the Wireshark site (answer)

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:

How do I setup Wireshark to run Lua's CLRPackage


You need to escape backslashes when using "..." strings. You can avoid escaping if you use [[...]] strings.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜