aboutsummaryrefslogtreecommitdiff
path: root/examples/py-flow-dashboard/flow-dash.py
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2022-02-05 15:09:21 +0100
committerToni Uhlig <matzeton@googlemail.com>2022-02-05 15:27:13 +0100
commitcb80c415d8a20b03f0d6a8f2fc38e8c8250a04da (patch)
tree70e53424c24795b3e9a159f8cfaa05e1630064a8 /examples/py-flow-dashboard/flow-dash.py
parent6fd6dff14d964aa8e5cf7ff3ec5a70c220ea61b4 (diff)
Improved py-flow-info to provide more optional information about received timestamps.
* py-flow-dashboard: Added color mapping for PieCharts/Graph that make more sense * nDPId: Renamed `flow_type' to a more precisely `flow_state' * nDPId: Changed the default setting to process only as much packets as libnDPI does Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'examples/py-flow-dashboard/flow-dash.py')
-rwxr-xr-xexamples/py-flow-dashboard/flow-dash.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/examples/py-flow-dashboard/flow-dash.py b/examples/py-flow-dashboard/flow-dash.py
index 2e3ea3dcf..947f5b48c 100755
--- a/examples/py-flow-dashboard/flow-dash.py
+++ b/examples/py-flow-dashboard/flow-dash.py
@@ -81,6 +81,8 @@ def nDPIsrvd_worker_onJsonLineRecvd(json_dict, instance, current_flow, global_us
shared_flow_dict[flow_id]['is_risky'] = False
shared_flow_dict[flow_id]['total-l4-bytes'] = 0
+ shared_flow_dict[flow_id]['json'] = mgr.dict()
+
shared_flow_dict['total-flows'] += 1
shared_flow_dict['current-flows'] += 1
@@ -93,11 +95,15 @@ def nDPIsrvd_worker_onJsonLineRecvd(json_dict, instance, current_flow, global_us
shared_flow_dict['current-midstream-flows'] += 1
shared_flow_dict[flow_id]['is_midstream'] = True
- if 'ndpi' in json_dict and 'flow_risk' in json_dict['ndpi']:
- if shared_flow_dict[flow_id]['is_risky'] is False:
- shared_flow_dict['total-risky-flows'] += 1
- shared_flow_dict['current-risky-flows'] += 1
- shared_flow_dict[flow_id]['is_risky'] = True
+ if 'ndpi' in json_dict:
+ # XXX: Will make use of that JSON string in Plotly. Soon..
+ shared_flow_dict[flow_id]['json']['ndpi'] = json_dict['ndpi']
+
+ if 'flow_risk' in json_dict['ndpi']:
+ if shared_flow_dict[flow_id]['is_risky'] is False:
+ shared_flow_dict['total-risky-flows'] += 1
+ shared_flow_dict['current-risky-flows'] += 1
+ shared_flow_dict[flow_id]['is_risky'] = True
if 'flow_event_name' not in json_dict:
return True