diff --git a/dissector/baichuan.lua b/dissector/baichuan.lua index e55a6ee..7070ba0 100644 --- a/dissector/baichuan.lua +++ b/dissector/baichuan.lua @@ -219,14 +219,13 @@ local header_lengths = { -- For other locations, use: LUA_CPATH=.../luagcrypt/?.so bc_protocol.prefs.key = Pref.string("Decryption key", "", "Passphrase used for the camera. Required to decrypt the AES packets") -bc_protocol.prefs.nonce = Pref.string("Nonce key", "", - "Nonce negotiate during login. You can find this in the msg_id == 1 packets.") +_G.nonce = "" local function hexencode(str) return (str:gsub(".", function(char) return string.format("%02X", char:byte()) end)) end local gcrypt = require("luagcrypt") local function aes_decrypt(data) - local raw_key = bc_protocol.prefs.nonce .. "-" .. bc_protocol.prefs.key + local raw_key = _G.nonce .. "-" .. bc_protocol.prefs.key local iv = "0123456789abcdef" local hasher = gcrypt.Hash(gcrypt.MD_MD5) hasher:write(raw_key) @@ -363,6 +362,8 @@ local function process_body(header, body_buffer, bc_subtree, pinfo) elseif xml_decrypt(xml_buffer(0,5):bytes(), header.enc_offset):raw() == "][ \t\n]*([^ \t\n<]+)[ \t\n]*[<][/]nonce[>]") + _G.nonce = new_noonce; body_tvb = decrypted:tvb("Decrypted XML (in Meta Payload)") -- Create a tree item that, when clicked, automatically shows the tab we just created body:add(body_tvb(), "Decrypted XML (in Meta Payload)")