日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

使用Lua编写whireshark插件

發布時間:2025/3/21 编程问答 38 豆豆
生活随笔 收集整理的這篇文章主要介紹了 使用Lua编写whireshark插件 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

whireshark支持Lua、C、C++編寫的插件

在這里,我簡單介紹如何使用Lua編寫whireshark插件。

一、插件的存放位置

whireshark插件分為個人插件和全局插件,在windows平臺上,個人插件的存放位置在:

#%APPDATA%是window下的一個環境變量,通過在cmd窗口輸入echo %APPDATA% 即可查看具體的信息 %APPDATA%\Wireshark\plugins

全局插件存放在:

#whireshark 的安裝目錄下的plugins目錄下 WIRESHARK\plugins

以上內容參考:https://www.wireshark.org/docs/wsug_html_chunked/ChPluginFolders.html

二、編寫插件

使用whireshark編寫一個whireshark插件如下(該插件的作用是在wihreshark的工具欄菜單下,增加一個菜單項:Lua Dialog Test),并保存到:%APPDATA%\Wireshark\plugins 目錄下面

if gui_enabled() thenlocal splash = TextWindow.new("Hello!");splash:set("This time wireshark has been enhanced with a useless feature.\n")splash:append("Go to 'Tools->Lua Dialog Test' and check it out!") endlocal function dialog_menu()local function dialog_func(person,eyes,hair)local window = TextWindow.new("Person Info");local message = string.format("Person %s with %s eyes and %s hair.", person, eyes, hair);window:set(message);endnew_dialog("Dialog Test",dialog_func,"A Person","Eyes","Hair") endregister_menu("Lua Dialog Test",dialog_menu,MENU_TOOLS_UNSORTED)

三、配置whireshark支持Lua插件

進入whireshark安裝目錄,打開init.lua文件,在文件的末尾加上(編寫的lua插件的位置):

dofile("C:\\Users\\lyh\\AppData\\Roaming\\Wireshark\\plugins\\menutest.lua")

并確保:

enable_lua = true

重啟whireshark即可看到,在打開工具查看即可看到:

附錄:可以在該地址找到whireshark 的lua插件案例:

https://wiki.wireshark.org/Lua/Examples

https://www.wireshark.org/docs/wsdg_html_chunked/wsluarm.html

總結

以上是生活随笔為你收集整理的使用Lua编写whireshark插件的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。