diff options
author | Luca <deri@ntop.org> | 2019-08-28 14:02:39 +0200 |
---|---|---|
committer | Luca <deri@ntop.org> | 2019-08-28 14:02:39 +0200 |
commit | e4e40e3c70e2cd49fd537a526fa70805c8c391c5 (patch) | |
tree | 98c605df4ac69cdef449d4eec700f5b74f621feb /example/ndpiReader.c | |
parent | 84aeee49bda71f71877ca114a1946a6d359be5d5 (diff) |
Added entropy, average, stddev, variance, bytes ratio calculation
Diffstat (limited to 'example/ndpiReader.c')
-rw-r--r-- | example/ndpiReader.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c index 3dd18d857..30eda2532 100644 --- a/example/ndpiReader.c +++ b/example/ndpiReader.c @@ -997,10 +997,19 @@ static void printFlow(u_int16_t id, struct ndpi_flow_info *flow, u_int16_t threa if(flow->info[0] != '\0') fprintf(out, "[%s]", flow->info); -#if 0 - if(flow->entropy.pktlen_c_to_s || flow->entropy.pktlen_s_to_c) - fprintf(out, "[pktlen entropy: %.2f / %.2f]", flow->entropy.pktlen_c_to_s, flow->entropy.pktlen_s_to_c); -#endif + if(flow->pktlen_c_to_s && flow->pktlen_s_to_c) { + fprintf(out, "[pktlen c2s avg(stddev)/entropy: %.1f(%.1f)/%.1f]", + ndpi_data_entropy(flow->pktlen_c_to_s), + ndpi_data_average(flow->pktlen_c_to_s), + ndpi_data_stddev(flow->pktlen_c_to_s)); + + fprintf(out, "[pktlen s2c avg(stddev)/entropy: %.1f(%.1f)/%.1f]", + ndpi_data_entropy(flow->pktlen_s_to_c), + ndpi_data_average(flow->pktlen_s_to_c), + ndpi_data_stddev(flow->pktlen_s_to_c)); + } + + fprintf(out, "[bytes ratio: %.2f]", ndpi_data_ratio(flow->src2dst_bytes, flow->dst2src_bytes)); if(flow->ssh_tls.ssl_version != 0) fprintf(out, "[%s]", ndpi_ssl_version2str(flow->ssh_tls.ssl_version)); if(flow->ssh_tls.client_info[0] != '\0') fprintf(out, "[client: %s]", flow->ssh_tls.client_info); |