diff --git a/examples/flow_printer.py b/examples/flow_printer.py index d0363f4..1b589ad 100644 --- a/examples/flow_printer.py +++ b/examples/flow_printer.py @@ -22,7 +22,7 @@ import sys path = sys.argv[1] -flow_streamer = NFStreamer(source=path) +flow_streamer = NFStreamer(source=path, idle_timeout=5) try: for flow in flow_streamer: print(flow) diff --git a/nfstream/__init__.py b/nfstream/__init__.py index 5498bbe..23a7d0f 100644 --- a/nfstream/__init__.py +++ b/nfstream/__init__.py @@ -18,8 +18,8 @@ If not, see . """ -from nfstream.streamer import NFStreamer -from nfstream.plugin import NFPlugin +from .streamer import NFStreamer +from .plugin import NFPlugin """ streamer module is the core module of nfstream package. diff --git a/nfstream/cache.py b/nfstream/cache.py index 57a65af..ce13412 100644 --- a/nfstream/cache.py +++ b/nfstream/cache.py @@ -74,7 +74,7 @@ class NFCache(object): self.active_timeout = 0 for root_idx in range(nroots): # init root self._roots.append(LRU(idle_timeout=self.idle_timeout)) - self.idle_scan_period = 0.01 + self.idle_scan_period = 0.001 self.idle_scanning = True self.current_tick = 0 self.current_root_idx = 0 # current updating to avoid collision diff --git a/nfstream/cc/README.rst b/nfstream/cc/README.rst deleted file mode 100644 index 8a0f1b3..0000000 --- a/nfstream/cc/README.rst +++ /dev/null @@ -1,8 +0,0 @@ -cc repository -------------- -This repository contains headers C definitions for ABI cffi bindings. - -Currently: - -* libpcap_cc.py: a portable C/C++ library for network traffic capture. -* libndpi_cc.py: Open and Extensible LGPLv3 Deep Packet Inspection Library. \ No newline at end of file diff --git a/nfstream/cc/__init__.py b/nfstream/cc/__init__.py deleted file mode 100644 index 36432ba..0000000 --- a/nfstream/cc/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -""" -file: __init__.py -This file is part of nfstream. - -Copyright (C) 2019 - Zied Aouini - -nfstream is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License -as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -nfstream is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty -of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with nfstream. -If not, see . -""" - -""" - cc module is c code definitions module for external libraries. -""" - -__author__ = """Zied Aouini""" -__email__ = 'aouinizied@gmail.com' -__version__ = '1.2.1' \ No newline at end of file diff --git a/nfstream/cc/libndpi_cc.py b/nfstream/libndpi_cc.py similarity index 100% rename from nfstream/cc/libndpi_cc.py rename to nfstream/libndpi_cc.py diff --git a/nfstream/cc/libpcap_cc.py b/nfstream/libpcap_cc.py similarity index 100% rename from nfstream/cc/libpcap_cc.py rename to nfstream/libpcap_cc.py diff --git a/nfstream/ndpi.py b/nfstream/ndpi.py index ef0e8ff..62da1c6 100644 --- a/nfstream/ndpi.py +++ b/nfstream/ndpi.py @@ -14,9 +14,9 @@ You should have received a copy of the GNU General Public License along with nfs If not, see . """ -from .cc.libndpi_cc import cc, cc_ndpi_network_headers, cc_ndpi_id_struct, cc_ndpi_flow_tcp_struct -from .cc.libndpi_cc import cc_ndpi_flow_udp_struct, cc_ndpi_int_one_line_struct, cc_ndpi_packet_struct -from .cc.libndpi_cc import cc_ndpi_packet_struct_stack, cc_ndpi_apis +from .libndpi_cc import cc, cc_ndpi_network_headers, cc_ndpi_id_struct, cc_ndpi_flow_tcp_struct +from .libndpi_cc import cc_ndpi_flow_udp_struct, cc_ndpi_int_one_line_struct, cc_ndpi_packet_struct +from .libndpi_cc import cc_ndpi_packet_struct_stack, cc_ndpi_apis from os.path import abspath, dirname import cffi diff --git a/nfstream/observer.py b/nfstream/observer.py index 14ee2a2..df17a72 100644 --- a/nfstream/observer.py +++ b/nfstream/observer.py @@ -22,7 +22,7 @@ from enum import Enum, IntEnum from threading import Lock from select import select from cffi import FFI -from .cc.libpcap_cc import cc, cc_packed +from .libpcap_cc import cc, cc_packed import os.path import sys diff --git a/nfstream/streamer.py b/nfstream/streamer.py index fee6427..8de5157 100644 --- a/nfstream/streamer.py +++ b/nfstream/streamer.py @@ -54,7 +54,6 @@ class NFStreamer(object): def __iter__(self): try: self._producer.start() - tm.sleep(0.1) self._consumer.connect('ipc:///tmp/nfstream.pipe') while True: try: