Make dissector extract the nonce itself
This commit is contained in:
1 file changed
+4
-3
@@ -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() == "<?xml" then -- Encrypted xml found
|
||||
local ba = xml_buffer:bytes()
|
||||
local decrypted = xml_decrypt(ba, header.enc_offset)
|
||||
local new_noonce = string.match(decrypted:raw(), "[<]nonce[>][ \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)")
|
||||
|
||||
Reference in new issue
Block a user