diff options
author | Luca <deri@ntop.org> | 2017-05-29 16:46:28 +0200 |
---|---|---|
committer | Luca <deri@ntop.org> | 2017-05-29 16:46:28 +0200 |
commit | 2b9f8f6a8924fbb747de5635ebb643478363f3fb (patch) | |
tree | 7dbb87a81315d8be27d1d0f483711804e6744c34 /wireshark | |
parent | 61f8f56719d7169729609471753d52ce0093c1a0 (diff) |
Fixed nDPI report formatting
Diffstat (limited to 'wireshark')
-rw-r--r-- | wireshark/ndpi.lua | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/wireshark/ndpi.lua b/wireshark/ndpi.lua index d6ff9c39d..a667749e0 100644 --- a/wireshark/ndpi.lua +++ b/wireshark/ndpi.lua @@ -421,7 +421,7 @@ function ndpi_proto.dissector(tvb, pinfo, tree) srckey = tostring(pinfo.src) dstkey = tostring(pinfo.dst) - flowkey = srckey.." / "..dstkey.." ["..ndpikey.."]" + flowkey = srckey.." / "..dstkey.."\t["..ndpikey.."]" if(ndpi_flows[flowkey] == nil) then ndpi_flows[flowkey] = 0 num_ndpi_flows = num_ndpi_flows + 1 @@ -524,13 +524,18 @@ local function ndpi_dialog_menu() local i if(ndpi_protos ~= {}) then + local tot = 0 label = "nDPI Protocol Breakdown\n" label = label .. "-----------------------\n" + for _,v in pairs(ndpi_protos) do + tot = tot + v + end + i = 0 for k,v in pairsByValues(ndpi_protos, rev) do - -- label = label .. k .. "\t".. bytesToSize(v) .. "\n" - label = label .. string.format("%-32s\t%s\n", k, bytesToSize(v)) + local pctg = formatPctg((v * 100) / tot) + label = label .. string.format("%-32s\t\t%s\t", k, bytesToSize(v)).. "\t["..pctg.."]\n" if(i == max_num_entries) then break else i = i + 1 end end @@ -540,7 +545,8 @@ local function ndpi_dialog_menu() label = label .. "-----------\n" i = 0 for k,v in pairsByValues(ndpi_flows, rev) do - label = label .. string.format("%-32s\t%s\n", k, bytesToSize(v)) + local pctg = formatPctg((v * 100) / tot) + label = label .. string.format("%-48s\t%s", k, bytesToSize(v)).. "\t["..pctg.."]\n" if(i == max_num_entries) then break else i = i + 1 end end |