aboutsummaryrefslogtreecommitdiff
path: root/examples/py-flow-info
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2020-09-26 11:19:21 +0200
committerToni Uhlig <matzeton@googlemail.com>2020-09-26 11:19:21 +0200
commit8c61f883621169f5c9451758eed4b3a4ee9ee3a2 (patch)
treeb5d3c5b25c9210cb8afcd5df09f1dff140020f81 /examples/py-flow-info
parentb6b62ac883b32dbe2d31a0b13c32a7752182f0d2 (diff)
Added event validation functions and fixed Python scripts.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'examples/py-flow-info')
-rwxr-xr-xexamples/py-flow-info/flow-info.py10
1 files changed, 6 insertions, 4 deletions
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 = ''