summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xnDPId-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