如何设置 Wireshark 来运行 Lua 的 CLRPackage

发布于 2024-12-01 07:09:42 字数 2372 浏览 2 评论 0 原文

我正在尝试设置 Wireshark 以便我可以使用 LuaInterface 使用.NET框架中的一些类。我可以通过 Lua 命令行让它运行,但是当我尝试在 init.lua 启动脚本中 require "CLRPackage" 时,它似乎并没有找到所需的文件。启动 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'

我尝试设置 package.pathpackage.cpath 以匹配命令行中设置的内容,但这似乎并不来帮忙。

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"

当我这样做时,出现以下错误:

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.

这是一个奇怪的错误,因为该文件确实存在。

我已在 C:\Program Files\Lua\5.1 中安装了适用于 Windows 的 Lua 包。

有人能够让它工作吗?任何帮助将不胜感激。

我正在使用 Wireshark 1.4.4 和 Lua 5.1.4

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

执着的年纪 2024-12-08 07:09:43

使用“...”字符串时需要转义反斜杠。如果使用 [[...]] 字符串,则可以避免转义。

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

涫野音 2024-12-08 07:09:42

我在 Wireshark 站点 (answer)

您的 Wireshark 太旧了。 当前的稳定版本是 Wireshark 1.6.1

Wireshark 已经包含 Lua。您不需要安装自己的 Lua 副本,因为 Wireshark 带有自己的 Lua 解释器(并且只会使用自己的)。但是,您的 Wireshark Lua 脚本仍然可以调用 LuaForWindows 安装的库。

LuaInterface 1.5.3 可能不兼容。 LuaForWindows v5.1.4-45 附带 LuaInterface 1.5.3,这可能与您的 Wireshark 安装不兼容(通过运行时错误 R6034 加载 luanet.dll 后)。对于我在 Windows 7 上使用 Wireshark 1.6.1 来说,情况确实如此。您可以从此

说明

1) 将 VS2005 SP1 Redistributables 从 LuaForWindows 复制到 Wireshark 的程序目录(或者您可以从 Microsoft 下载 redist 软件包...参见票证):

来自:

  • %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\安装\support\Microsoft.VC80.CRT.SP1\msvcr80.dll

收件人:

  • %PROGRAMFILES%\Wireshark\Microsoft.VC80.CRT.manifest
  • %PROGRAMFILES%\Wireshark\msvcm80.dll
  • %PROGRAMFILES%\Wireshark\msvcp80.dll
  • %PROGRAMFILES%\Wireshark\msvcr80.dll
    2) 从该票据下载 LuaInterface 2.0.3 ZIP,并从中复制以下内容:

来自:

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

至:

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

来自:

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

到:

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

3) 如果已在运行,请重新启动 Wireshark/TShark。

4) 可选:从 Wireshark,打开菜单工具 >卢阿>评估。在出现的文本框中,输入一些 示例代码,然后单击评估

这应该会导致类似这样的结果:

输出

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:

Output

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文