Update example.
This commit is contained in:
+15
-16
@@ -2,27 +2,26 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
"""
|
||||||
file: flow_printer.py
|
------------------------------------------------------------------------------------------------------------------------
|
||||||
This file is part of nfstream.
|
flow_printer.py
|
||||||
|
Copyright (C) 2019-20 - NFStream Developers
|
||||||
Copyright (C) 2019-20 - Zied Aouini <aouinizied@gmail.com>
|
This file is part of NFStream, a Flexible Network Data Analysis Framework (https://www.nfstream.org/).
|
||||||
|
NFStream is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
|
||||||
nfstream is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
|
License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
|
||||||
as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
version.
|
||||||
|
NFStream is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||||
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 Lesser General Public License for more details.
|
||||||
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 Lesser General Public License along with NFStream.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License along with nfstream.
|
|
||||||
If not, see <http://www.gnu.org/licenses/>.
|
If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
------------------------------------------------------------------------------------------------------------------------
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from nfstream import NFStreamer
|
from nfstream import NFStreamer
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
# Example must run with nfstream >= 6.1.1
|
||||||
path = sys.argv[1]
|
path = sys.argv[1]
|
||||||
flow_streamer = NFStreamer(source=path, statistics=True)
|
flow_streamer = NFStreamer(source=path, statistical_analysis=False, performance_report=1)
|
||||||
result = {}
|
result = {}
|
||||||
try:
|
try:
|
||||||
for flow in flow_streamer:
|
for flow in flow_streamer:
|
||||||
@@ -31,9 +30,9 @@ try:
|
|||||||
result[flow.application_name] += flow.bidirectional_packets
|
result[flow.application_name] += flow.bidirectional_packets
|
||||||
except KeyError:
|
except KeyError:
|
||||||
result[flow.application_name] = flow.bidirectional_packets
|
result[flow.application_name] = flow.bidirectional_packets
|
||||||
print("Summary (Application Name: Packets):")
|
print("\nSummary (Application Name: Packets):")
|
||||||
print(result)
|
print(result)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("Summary (Application Name: Packets):")
|
print("\nSummary (Application Name: Packets):")
|
||||||
print(result)
|
print(result)
|
||||||
print("Terminated.")
|
print("Terminated.")
|
||||||
|
|||||||
Reference in New Issue
Block a user