diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2022-02-04 00:32:04 +0100 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2022-02-04 01:12:18 +0100 |
commit | 6fd6dff14d964aa8e5cf7ff3ec5a70c220ea61b4 (patch) | |
tree | 48a59cdf9cd204577fa7706d455de9c239e13dc6 /dependencies/nDPIsrvd.py | |
parent | f9e4c5885423c6f5b3d8b46c1c872b9e9330b054 (diff) |
Added additional (minimalistic) detection information to flow updates.
This will only affect flows with the state `FT_FINISHED' (detection done).
* nDPIsrvd.py: force use of JSON schema Draft 7 validator
* flow-dash.py: gather/use total processed layer4 payload size
* flow-info.py: added additional event filter
* flow-info.py: prettified flow events printing whose detection is in progress
* py-semantic-validation.py: added validation checks for FT_FINISHED
* updated flow event JSON schema
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'dependencies/nDPIsrvd.py')
-rw-r--r-- | dependencies/nDPIsrvd.py | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/dependencies/nDPIsrvd.py b/dependencies/nDPIsrvd.py index e1aae5c63..58156560e 100644 --- a/dependencies/nDPIsrvd.py +++ b/dependencies/nDPIsrvd.py @@ -170,12 +170,13 @@ class FlowManager: json_dict['daemon_event_name'].lower() == 'shutdown': # invalidate all existing flows with that alias/source for flow_id in instance.flows: - flow = instance.flows.pop(flow_id) + flow = instance.flows[flow_id] if json_dict['daemon_event_name'].lower() == 'init': flow.cleanup_reason = FlowManager.CLEANUP_REASON_DAEMON_INIT else: flow.cleanup_reason = FlowManager.CLEANUP_REASON_DAEMON_SHUTDOWN flows[flow_id] = flow + instance.flows = dict() del self.instances[instance.alias][instance.source] elif 'flow_event_name' in json_dict and \ @@ -434,16 +435,28 @@ def validateAgainstSchema(json_dict): import jsonschema if 'packet_event_id' in json_dict: - jsonschema.validate(instance=json_dict, schema=schema['packet_event_schema']) + try: + jsonschema.Draft7Validator(schema=schema['packet_event_schema']).validate(instance=json_dict) + except AttributeError: + jsonschema.validate(instance=json_dict, schema=schema['packet_event_schema']) return True if 'basic_event_id' in json_dict: - jsonschema.validate(instance=json_dict, schema=schema['basic_event_schema']) + try: + jsonschema.Draft7Validator(schema=schema['basic_event_schema']).validate(instance=json_dict) + except AttributeError: + jsonschema.validate(instance=json_dict, schema=schema['basic_event_schema']) return True if 'daemon_event_id' in json_dict: - jsonschema.validate(instance=json_dict, schema=schema['daemon_event_schema']) + try: + jsonschema.Draft7Validator(schema=schema['daemon_event_schema']).validate(instance=json_dict) + except AttributeError: + jsonschema.validate(instance=json_dict, schema=schema['daemon_event_schema']) return True if 'flow_event_id' in json_dict: - jsonschema.validate(instance=json_dict, schema=schema['flow_event_schema']) + try: + jsonschema.Draft7Validator(schema=schema['flow_event_schema']).validate(instance=json_dict) + except AttributeError: + jsonschema.validate(instance=json_dict, schema=schema['flow_event_schema']) return True return False |