diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2020-07-17 20:21:15 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2020-07-17 20:21:15 +0200 |
commit | f757b9d313efb1aebfdd4c90925d2de1688a909d (patch) | |
tree | cec04ef469a258ce331732eae076233ed3119ac6 | |
parent | ef7c11a750a8dd64ad46c84d4871e29b47b38583 (diff) |
renamed collector to debug and removed obsolete, unused code
-rwxr-xr-x | nDPId-debug.py (renamed from nDPId-collect.py) | 22 |
1 files changed, 1 insertions, 21 deletions
diff --git a/nDPId-collect.py b/nDPId-debug.py index a8d692fd5..dfda86618 100755 --- a/nDPId-collect.py +++ b/nDPId-debug.py @@ -3,12 +3,7 @@ import json import sys import asyncio -try: - import base64 - from scapy.all import wrpcap - WRITE_PCAP=True -except ModuleNotFoundError: - WRITE_PCAP=False +import base64 JSON_SOCKPATH = '/tmp/ndpid-collector.sock' JSON_FILTER = [] @@ -32,7 +27,6 @@ def json_filter_check(json_object): class nDPIdFlow(object): def __init__(self, thread_id): self.thread_id = thread_id - packets = [] class JsonCollector(asyncio.Protocol): def log_key_error(self, exception): @@ -53,17 +47,6 @@ class JsonCollector(asyncio.Protocol): except KeyError as exc: self.log_key_error(exc) - def add_pkt(self, json_object): - try: - flow_id = str(json_object['flow_id']) - max_pkt = json_object['max_packets'] - self.flows[flow_id].packets += [ base64.b64decode(json_object['pkt']) ] - if len(self.flows[flow_id].packets) == max_pkt: - #wrpcap('ndpid-unknown-' + flow_id, self.flows[flow_id].packets) - del self.flows[flow_id].packets - except KeyError as exc: - self.log_key_error(exc) - def cleanup(self, json_object): try: thread_id = json_object['thread_id'] @@ -96,9 +79,6 @@ class JsonCollector(asyncio.Protocol): self.del_flow(json_object) elif json_object['flow_event_name'] == 'idle': self.del_flow(json_object) - if 'packet_event_name' in json_object: - if json_object['packet_event_name'] == 'packet-flow': - self.add_pkt(json_object) if json_filter_check(json_object) is False: continue |