Add guessed.

This commit is contained in:
aouinizied 2019-11-07 17:39:34 +01:00
parent 49e1e094b5
commit a33aa1f363
4 changed files with 4 additions and 9 deletions

View file

@ -1,5 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from nfstream import streamer
@ -9,4 +8,4 @@ from nfstream import streamer
__author__ = """Zied Aouini"""
__email__ = 'aouinizied@gmail.com'
__version__ = '1.1.7'
__version__ = '1.1.7'

View file

@ -39,6 +39,7 @@ class NDPIClassifier(NFStreamClassifier):
flow.classifiers[self.name]['dst_id'] = pointer(ndpi_id_struct())
flow.classifiers[self.name]['application_name'] = ''
flow.classifiers[self.name]['category_name'] = ''
flow.classifiers[self.name]['guessed'] = 0
def on_flow_update(self, packet_information, flow, direction):
NFStreamClassifier.on_flow_update(self, packet_information, flow, direction)
@ -68,6 +69,7 @@ class NDPIClassifier(NFStreamClassifier):
1,
cast(addressof(c_uint8(0)), POINTER(c_uint8))
)
flow.classifiers[self.name]['guessed'] = 1
# HERE you can change flow.export_reason to a value > 2 and the flow will be terminated automatically
def on_flow_terminate(self, flow):

View file

@ -1,10 +1,3 @@
"""
This source code is part of nDPI python bindings
original source code is available here: https://github.com/ntop/nDPI/tree/dev/python
We keep it as part of nfstream in order to be independent as we plan to implement an abstration layer in case
we support several deep packet inspection engines.
"""
from ctypes import CDLL, Structure, c_uint16, c_int, c_ulong, c_uint32, CFUNCTYPE, c_void_p, POINTER, c_char_p, c_uint8
from ctypes import c_char, c_uint, c_int16, c_longlong, c_size_t, Union, c_ubyte, c_uint64, c_int32, c_ushort
from os.path import abspath, dirname

View file

@ -96,6 +96,7 @@ class Flow:
'ip_dst': self.ip_dst_str,
'dst_port': self.dst_port,
'ip_protocol': self.ip_protocol,
'vlan_id': self.vlan_id,
'src_to_dst_pkts': self.src_to_dst_pkts,
'dst_to_src_pkts': self.dst_to_src_pkts,
'src_to_dst_bytes': self.src_to_dst_bytes,