From 8c61f883621169f5c9451758eed4b3a4ee9ee3a2 Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Sat, 26 Sep 2020 11:19:21 +0200 Subject: Added event validation functions and fixed Python scripts. Signed-off-by: Toni Uhlig --- examples/py-flow-info/flow-info.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'examples/py-flow-info/flow-info.py') diff --git a/examples/py-flow-info/flow-info.py b/examples/py-flow-info/flow-info.py index 638c76581..61f25429d 100755 --- a/examples/py-flow-info/flow-info.py +++ b/examples/py-flow-info/flow-info.py @@ -11,10 +11,12 @@ from nDPIsrvd import nDPIsrvdSocket, TermColor def parse_json_str(json_str): j = nDPIsrvd.JsonParseBytes(json_str[0]) - - event_str = validateEventName(j) - if event_str is None: - raise RuntimeError('unknown flow event name: {}'.format(event)) + event_str = nDPIsrvd.validateFlowEventName(j) + if event_str is 'Unknown': + if nDPIsrvd.validatePacketEventName(j) is 'Unknown': + raise RuntimeError('Missing flow_event_name in the JSON string.') + else: + return ndpi_proto_categ = '' ndpi_frisk = '' -- cgit v1.2.3