From 2e1e787a828b7d474236985ed426bd33d8de520d Mon Sep 17 00:00:00 2001 From: Ruud Siebierski Date: Thu, 27 Jul 2017 12:34:04 +0200 Subject: [PATCH 1/2] Added little endian decoding of length prefix --- lppb.lua | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lppb.lua b/lppb.lua index 2526826..27e1d85 100644 --- a/lppb.lua +++ b/lppb.lua @@ -1,15 +1,24 @@ -local lppb = Proto("lppb","Length Prefixed Protocol Buffers"); +local lppb = Proto("lppb","Length Prefixed Protocol Buffers"); +info("starting") len_F = ProtoField.string("lppb.len","Length") lppb.fields = {len_F} lppb.prefs.port = Pref.uint("TCP Port:", 0, "") lppb.prefs.schema = Pref.string("Schema:", "", "E.g. MY.PROTOBUF.MESSAGE") lppb.prefs.prefix_size = Pref.uint("Prefix size (bytes):", 4, "") +lppb.prefs.prefix_endianess = Pref.bool("Little Endian ?", true, "Check this to decode the length prefix as if it were encoded as Little Endian") function get_message_len(tvb, pinfo, tree) - local len = tvb:range(0, lppb.prefs.prefix_size):uint() - return len + lppb.prefs.prefix_size + local length_buf = tvb:range(0, lppb.prefs.prefix_size) + local len = 0 + if lppb.prefs.prefix_endianess then + len = Struct.unpack(' Date: Thu, 27 Jul 2017 12:38:07 +0200 Subject: [PATCH 2/2] Removed debug code --- lppb.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/lppb.lua b/lppb.lua index 27e1d85..30ae530 100644 --- a/lppb.lua +++ b/lppb.lua @@ -1,6 +1,4 @@ - local lppb = Proto("lppb","Length Prefixed Protocol Buffers"); -info("starting") len_F = ProtoField.string("lppb.len","Length") lppb.fields = {len_F}