aboutsummaryrefslogtreecommitdiff
path: root/example/reader_util.c
diff options
context:
space:
mode:
authorLuca Deri <deri@ntop.org>2020-02-17 22:15:36 +0100
committerLuca Deri <deri@ntop.org>2020-02-17 22:15:36 +0100
commitfdf8dd724fc86c4d38daa66b62021ae2d34f1432 (patch)
tree219478b1973ff6dc5b4be8f24ff2b47c11e2c955 /example/reader_util.c
parent37121a9b587f179faa1c69f8b4014b2c9c9590f0 (diff)
Minor fix
Diffstat (limited to 'example/reader_util.c')
-rw-r--r--example/reader_util.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/example/reader_util.c b/example/reader_util.c
index 8b7f55fe4..ec070afb3 100644
--- a/example/reader_util.c
+++ b/example/reader_util.c
@@ -458,7 +458,18 @@ void ndpi_flow_info_freer(void *node) {
ndpi_free_flow_data_analysis(flow);
if(flow->ssh_tls.server_names) {
- ndpi_free(flow->ssh_tls.server_names); flow->ssh_tls.server_names = NULL;
+ ndpi_free(flow->ssh_tls.server_names);
+ flow->ssh_tls.server_names = NULL;
+ }
+
+ if(flow->ssh_tls.tls_alpn) {
+ ndpi_free(flow->ssh_tls.tls_alpn);
+ flow->ssh_tls.tls_alpn = NULL;
+ }
+
+ if(flow->ssh_tls.tls_supported_versions) {
+ ndpi_free(flow->ssh_tls.tls_supported_versions);
+ flow->ssh_tls.tls_supported_versions = NULL;
}
ndpi_free(flow);
@@ -949,6 +960,8 @@ static u_int8_t is_ndpi_proto(struct ndpi_flow_info *flow, u_int16_t id) {
/* ****************************************************** */
void process_ndpi_collected_info(struct ndpi_workflow * workflow, struct ndpi_flow_info *flow) {
+ u_int i;
+
if(!flow->ndpi_flow) return;
snprintf(flow->host_server_name, sizeof(flow->host_server_name), "%s",
@@ -960,7 +973,7 @@ void process_ndpi_collected_info(struct ndpi_workflow * workflow, struct ndpi_fl
if(is_ndpi_proto(flow, NDPI_PROTOCOL_DHCP)) {
snprintf(flow->dhcp_fingerprint, sizeof(flow->dhcp_fingerprint), "%s", flow->ndpi_flow->protos.dhcp.fingerprint);
} else if(is_ndpi_proto(flow, NDPI_PROTOCOL_BITTORRENT)) {
- u_int i, j, n = 0;
+ u_int j, n = 0;
for(i=0, j = 0; j < sizeof(flow->bittorent_hash)-1; i++) {
sprintf(&flow->bittorent_hash[j], "%02x",
@@ -1075,6 +1088,20 @@ void process_ndpi_collected_info(struct ndpi_workflow * workflow, struct ndpi_fl
flow->ssh_tls.sha1_cert_fingerprint_set = 1;
}
+ if(flow->ndpi_flow->protos.stun_ssl.ssl.alpn) {
+ if((flow->ssh_tls.tls_alpn = ndpi_strdup(flow->ndpi_flow->protos.stun_ssl.ssl.alpn)) != NULL) {
+ /* Replace , with ; to avoid issues with CSVs */
+ for(i=0; flow->ssh_tls.tls_alpn[i] != '\0'; i++) if(flow->ssh_tls.tls_alpn[i] == ',') flow->ssh_tls.tls_alpn[i] = ';';
+ }
+ }
+
+ if(flow->ssh_tls.tls_supported_versions) {
+ if((flow->ssh_tls.tls_supported_versions = ndpi_strdup(flow->ndpi_flow->protos.stun_ssl.ssl.tls_supported_versions)) != NULL) {
+ /* Replace , with ; to avoid issues with CSVs */
+ for(i=0; flow->ssh_tls.tls_supported_versions[i] != '\0'; i++) if(flow->ssh_tls.tls_supported_versions[i] == ',') flow->ssh_tls.tls_supported_versions[i] = ';';
+ }
+ }
+
if(flow->ndpi_flow->protos.stun_ssl.ssl.alpn
&& flow->ndpi_flow->protos.stun_ssl.ssl.tls_supported_versions)
snprintf(flow->info, sizeof(flow->info), "ALPN: %s][TLS Supported Versions: %s",
@@ -1522,7 +1549,7 @@ struct ndpi_proto ndpi_workflow_process_packet(struct ndpi_workflow * workflow,
if(header->caplen < (eth_offset + radio_len + sizeof(struct ndpi_wifi_header)))
return(nproto);
-
+
/* Calculate 802.11 header length (variable) */
wifi = (struct ndpi_wifi_header*)( packet + eth_offset + radio_len);