How to use the nfstream.ndpi_bindings.NDPIFlowStruct function in nfstream

To help you get started, we’ve selected a few nfstream examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aouinizied / nfstream / nfstream / classifier.py View on Github external
def on_flow_init(self, flow):
        NFStreamClassifier.on_flow_init(self, flow)
        flow.classifiers[self.name]['ndpi_flow'] = NDPIFlowStruct()
        memset(byref(flow.classifiers[self.name]['ndpi_flow']), 0, sizeof(NDPIFlowStruct))
        flow.classifiers[self.name]['detected_protocol'] = NDPIProtocol()
        flow.classifiers[self.name]['detection_completed'] = 0
        flow.classifiers[self.name]['src_id'] = pointer(NDPIIdStruct())
        flow.classifiers[self.name]['dst_id'] = pointer(NDPIIdStruct())
        flow.classifiers[self.name]['application_name'] = ''
        flow.classifiers[self.name]['category_name'] = ''
        flow.classifiers[self.name]['guessed'] = 0
github aouinizied / nfstream / nfstream / classifier.py View on Github external
def on_flow_init(self, flow):
        NFStreamClassifier.on_flow_init(self, flow)
        flow.classifiers[self.name]['ndpi_flow'] = NDPIFlowStruct()
        memset(byref(flow.classifiers[self.name]['ndpi_flow']), 0, sizeof(NDPIFlowStruct))
        flow.classifiers[self.name]['detected_protocol'] = NDPIProtocol()
        flow.classifiers[self.name]['detection_completed'] = 0
        flow.classifiers[self.name]['src_id'] = pointer(NDPIIdStruct())
        flow.classifiers[self.name]['dst_id'] = pointer(NDPIIdStruct())
        flow.classifiers[self.name]['application_name'] = ''
        flow.classifiers[self.name]['category_name'] = ''
        flow.classifiers[self.name]['guessed'] = 0
github aouinizied / nfstream / nfstream / ndpi_bindings.py View on Github external
('packet_lines_parsed_complete', c_uint8, 1),
        ('packet_direction', c_uint8, 1),
        ('empty_line_position_set', c_uint8, 1),
        ('pad', c_uint8, 5),
    ]


class NDPIFlowStructStack(Structure):
    _pack_ = 1
    _fields_ = [
        ("detected_protocol_stack", c_uint16 * ndpi.ndpi_wrap_ndpi_procol_size()),
        ("protocol_stack_info", c_uint16)
    ]


NDPIFlowStruct._fields_ = [
    ("ndpi_flow_stack", NDPIFlowStructStack),
    ("guessed_protocol_id", c_uint16),
    ("guessed_host_protocol_id", c_uint16),
    ("guessed_category", c_uint16),
    ("guessed_header_category", c_uint16),
    ("l4_proto", c_uint8),
    ("protocol_id_already_guessed", c_uint8, 1),
    ("host_already_guessed", c_uint8, 1),
    ("init_finished", c_uint8, 1),
    ("setup_packet_direction", c_uint8, 1),
    ("packet_direction", c_uint8, 1),
    ("check_extra_packets", c_uint8, 1),
    ("next_tcp_seq_nr", c_uint32 * 2),
    ("max_extra_packets_to_check", c_uint8),
    ("num_extra_packets_checked", c_uint8),
    ("num_processed_pkts", c_uint8),
github aouinizied / nfstream / nfstream / ndpi_bindings.py View on Github external
pass


NDPINode._fields_ = [
    ('key', POINTER(c_char)),
    ('left', POINTER(NDPINode)),
    ('right', POINTER(NDPINode)),
]


class NDPICallFunctionStruct(Structure):
    _fields_ = [
        ("detection_bitmask", NDPIProtocolBitMask),
        ("excluded_protocol_bitmask", NDPIProtocolBitMask),
        ("ndpi_selection_bitmask", c_uint32),
        ("func", CFUNCTYPE(None, POINTER(NDPIDetectionModuleStruct), POINTER(NDPIFlowStruct))),
        ("detection_feature", c_uint8)
    ]


class NDPIProtoDefaultsT(Structure):
    _fields_ = [
        ("protoName", c_char_p),
        ("protoCategory", c_uint),
        ("can_have_a_subprotocol", c_uint8),
        ("protoId", c_uint16),
        ("protoIdx", c_uint16),
        ("master_tcp_protoId", c_uint16 * 2),
        ("master_udp_protoId", c_uint16 * 2),
        ("protoBreed", c_uint),
        ("func", CFUNCTYPE(None, POINTER(NDPIDetectionModuleStruct), POINTER(NDPIFlowStruct))),
    ]