aboutsummaryrefslogtreecommitdiff
path: root/wireshark
diff options
context:
space:
mode:
authorLuca <deri@ntop.org>2017-05-29 16:46:28 +0200
committerLuca <deri@ntop.org>2017-05-29 16:46:28 +0200
commit2b9f8f6a8924fbb747de5635ebb643478363f3fb (patch)
tree7dbb87a81315d8be27d1d0f483711804e6744c34 /wireshark
parent61f8f56719d7169729609471753d52ce0093c1a0 (diff)
Fixed nDPI report formatting
Diffstat (limited to 'wireshark')
-rw-r--r--wireshark/ndpi.lua14
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