【问题标题】:how to dynamically decrypt data in wireshark如何在wireshark中动态解密数据
【发布时间】:2023-04-09 21:54:01
【问题描述】:

我在wireshark 中为我的协议编写了​​一个lua 解析器:my.lua。问题是我的协议对数据使用 AES 加密,每个会话的加密 AES 密钥都不同。

现在我硬编码了my.lua中的16字节aes-key,但是每次开始抓包或者加载一些保存的数据包之前,我都需要修改硬编码的值,非常不方便。

wireshark 中是否有允许用户输入内容的方法?例如,一个弹出对话框显示:"please input the aes key",用户输入后,lua 脚本使用它进行解密。

【问题讨论】:

  • 你好,我也在做类似的事情,你能分享你的关于可以解密 AES 数据的解剖器的 lua 脚本吗?

标签: wireshark wireshark-dissector


【解决方案1】:

考虑使用 Prefs API。创建新首选项就像在读取首选项时设置索引一样简单:

your_proto = Proto("yourproto", "Your Proto")
your_proto.prefs.key = Pref.string("Decryption key", "", "128-bit AES key (in hex)")

function your_proto.dissector(tvb, pinfo, tree)
    local decryption_key = your_proto.prefs.key
    decrypt(tvb, tvb())  -- assume suitable "decrypt" routine
end

然后您可以右键单击协议树,选择协议首选项并修改您的设置。有关文档,请参阅 https://www.wireshark.org/docs/wsdg_html_chunked/lua_module_Proto.html#lua_class_Pref。

(无耻插件:)可以在此处找到将 Preferences API 与 luagcrypt 库一起使用的示例(用于更快的 AES 解密):

【讨论】:

    猜你喜欢
    • 2021-12-14
    • 2020-12-15
    • 2017-07-12
    • 1970-01-01
    • 2017-09-23
    • 1970-01-01
    • 2020-11-01
    • 2017-11-24
    • 2021-05-09
    相关资源
    最近更新 更多