如何在Wireshark中动态解密数据



我在Wireshark:my.lua中为我的协议写了一个LUA解剖器。问题是我的协议使用AES加密来用于数据,每个会话的加密AES密钥都不同。

现在,我在my.lua中对16字节 - AES键进行了硬编码,但是每次我开始捕获或加载一些保存的数据包之前,我都需要修改硬编码值,这非常不便。

>

无论如何,Wireshark是否可以允许用户输入某些内容?例如,弹出对话框说:"please input the aes key"和用户输入后,LUA脚本使用它进行解密。

考虑使用PERFS API。创建新的偏好就像在阅读pref时设置索引一样简单,正在阅读索引:

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 for docs。

(无耻的插头:)使用luagcrypt库中的首选项API(可以更快地解密)的一个示例:

  • kdnet的Wireshark lua解剖器
  • luagcrypt,与libgcrypt结合的lua

最新更新