Implemented Zoom/Teams stream type detection

This commit is contained in:
Luca Deri
2023-06-14 23:44:57 +02:00
parent 66bee475ae
commit d0609ea601
9 changed files with 121 additions and 46 deletions
+24
View File
@@ -1522,6 +1522,30 @@ static void printFlow(u_int32_t id, struct ndpi_flow_info *flow, u_int16_t threa
ndpi_get_proto_name(ndpi_thread_info[thread_id].workflow->ndpi_struct,
flow->detected_protocol.protocol_by_ip));
if(flow->multimedia_flow_type != ndpi_multimedia_unknown_flow) {
const char *content;
switch(flow->multimedia_flow_type) {
case ndpi_multimedia_audio_flow:
content = "Audio";
break;
case ndpi_multimedia_video_flow:
content = "Video";
break;
case ndpi_multimedia_screen_sharing_flow:
content = "Screen Sharing";
break;
default:
content = "???";
break;
}
fprintf(out, "[Stream Content: %s]", content);
}
fprintf(out, "[%s]",
ndpi_is_encrypted_proto(ndpi_thread_info[thread_id].workflow->ndpi_struct,
flow->detected_protocol) ? "Encrypted" : "ClearText");
+15 -9
View File
@@ -1,7 +1,7 @@
/*
* reader_util.c
*
* Copyright (C) 2011-22 - ntop.org
* Copyright (C) 2011-23 - ntop.org
*
* This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -1141,16 +1141,17 @@ void process_ndpi_collected_info(struct ndpi_workflow * workflow, struct ndpi_fl
flow->num_dissector_calls = flow->ndpi_flow->num_dissector_calls;
ndpi_snprintf(flow->host_server_name, sizeof(flow->host_server_name), "%s",
flow->ndpi_flow->host_server_name);
flow->ndpi_flow->host_server_name);
ndpi_snprintf(flow->flow_extra_info, sizeof(flow->flow_extra_info), "%s",
flow->ndpi_flow->flow_extra_info);
flow->ndpi_flow->flow_extra_info);
flow->risk = flow->ndpi_flow->risk;
if(is_ndpi_proto(flow, NDPI_PROTOCOL_DHCP)) {
if(flow->ndpi_flow->protos.dhcp.fingerprint[0] != '\0')
flow->dhcp_fingerprint = ndpi_strdup(flow->ndpi_flow->protos.dhcp.fingerprint);
if(flow->ndpi_flow->protos.dhcp.class_ident[0] != '\0')
flow->dhcp_class_ident = ndpi_strdup(flow->ndpi_flow->protos.dhcp.class_ident);
} else if(is_ndpi_proto(flow, NDPI_PROTOCOL_BITTORRENT) &&
@@ -1160,6 +1161,7 @@ void process_ndpi_collected_info(struct ndpi_workflow * workflow, struct ndpi_fl
if(flow->ndpi_flow->protos.bittorrent.hash[0] != '\0') {
flow->bittorent_hash = ndpi_malloc(sizeof(flow->ndpi_flow->protos.bittorrent.hash) * 2 + 1);
if(flow->bittorent_hash) {
for(i=0, j = 0; i < sizeof(flow->ndpi_flow->protos.bittorrent.hash); i++) {
sprintf(&flow->bittorent_hash[j], "%02x",
@@ -1167,6 +1169,7 @@ void process_ndpi_collected_info(struct ndpi_workflow * workflow, struct ndpi_fl
j += 2;
}
flow->bittorent_hash[j] = '\0';
}
}
@@ -1369,6 +1372,11 @@ void process_ndpi_collected_info(struct ndpi_workflow * workflow, struct ndpi_fl
}
}
if(is_ndpi_proto(flow, NDPI_PROTOCOL_ZOOM))
flow->multimedia_flow_type = flow->ndpi_flow->zoom.flow_type;
else if(is_ndpi_proto(flow, NDPI_PROTOCOL_SKYPE_TEAMS_CALL))
flow->multimedia_flow_type = flow->ndpi_flow->skype_teams.flow_type;
/* HTTP metadata are "global" not in `flow->ndpi_flow->protos` union; for example, we can have
HTTP/BitTorrent and in that case we want to export also HTTP attributes */
if(is_ndpi_proto(flow, NDPI_PROTOCOL_HTTP)
@@ -1388,8 +1396,7 @@ void process_ndpi_collected_info(struct ndpi_workflow * workflow, struct ndpi_fl
sizeof(flow->http.user_agent),
"%s", (flow->ndpi_flow->http.user_agent ? flow->ndpi_flow->http.user_agent : ""));
if (workflow->ndpi_serialization_format != ndpi_serialization_format_unknown)
{
if (workflow->ndpi_serialization_format != ndpi_serialization_format_unknown) {
if (ndpi_flow2json(workflow->ndpi_struct, flow->ndpi_flow,
flow->ip_version, flow->protocol,
flow->vlan_id,
@@ -1397,17 +1404,16 @@ void process_ndpi_collected_info(struct ndpi_workflow * workflow, struct ndpi_fl
&flow->src_ip6, &flow->dst_ip6,
flow->src_port, flow->dst_port,
flow->detected_protocol,
&flow->ndpi_flow_serializer) != 0)
{
&flow->ndpi_flow_serializer) != 0) {
LOG(NDPI_LOG_ERROR, "flow2json failed\n");
exit(-1);
}
ndpi_serialize_string_uint32(&flow->ndpi_flow_serializer, "detection_completed", flow->detection_completed);
ndpi_serialize_string_uint32(&flow->ndpi_flow_serializer, "check_extra_packets", flow->check_extra_packets);
}
if(flow->detection_completed && (!flow->check_extra_packets)) {
if(flow->detection_completed && (!flow->check_extra_packets)) {
flow->flow_payload = flow->ndpi_flow->flow_payload, flow->flow_payload_len = flow->ndpi_flow->flow_payload_len;
flow->ndpi_flow->flow_payload = NULL; /* We'll free the memory */
+8
View File
@@ -214,30 +214,36 @@ typedef struct ndpi_flow_info {
*pktlen_c_to_s, *pktlen_s_to_c;
enum info_type info_type;
union {
char info[256];
struct {
unsigned char auth_failed;
char username[127];
char password[128];
} ftp_imap_pop_smtp;
struct {
char domain[85];
char hostname[85];
char username[86];
} kerberos;
struct {
char ip[16];
char port[6];
char hostname[48];
char fqdn[48];
} softether;
struct {
char identity_uuid[36];
char machine[48];
char platform[32];
char services[48];
} tivoconnect;
struct {
uint16_t result_code;
uint16_t internal_port;
@@ -289,6 +295,8 @@ typedef struct ndpi_flow_info {
char *username, *password;
} telnet;
ndpi_multimedia_flow_type multimedia_flow_type;
void *src_id, *dst_id;
struct ndpi_entropy *entropy;