I want to use lua api to dissect the custom tls v1.2 protocol.
I configured the RSA key files to decrypt TLS and the decrypted TLS info is shown as wanted.
To decrypt tls with lua, I register it to the tls.port: DissectorTable.get("tls.port"):add(port_id, my_protocol). But i find the dissector can't be actived, because the beginning print don't show in the lua console.
Please Help me to figure out how to active the lua dessector.
My demo as below:
smart_data_protocol = Proto("SmartData","SmartData Protocol")
-- fields component
data_header_status = ProtoField.uint16("smart_data.data_header_status", "data_header_status", base.DEC)
smart_data_protocol.fields = {data_header_status}
function smart_data_protocol.dissector(buffer, pinfo, tree)
print("start dissector")
length = buffer:len()
if length == 0 then
return 0
end
version = buffer(1,1):uint()
if version ~= 0x03 then
print("version ~= 0x03 ")
return 0
end
print("version == 0x03 ")
pinfo.cols.protocol = smart_data_protocol.name
print("cols.protocol ")
local subtree = tree:add(smart_data_protocol, buffer(), "SmartData Protocol Data")
print("local subtree ")
subtree:add(data_header_status, buffer(1,1))
print("subtree:add")
end
DissectorTable.get("tls.port"):add(my_port, smart_data_protocol)
Thanks a lot!