diff options
author | Luca Deri <deri@ntop.org> | 2021-03-14 21:54:35 +0100 |
---|---|---|
committer | Luca Deri <deri@ntop.org> | 2021-03-14 21:54:35 +0100 |
commit | 1b6275005e01eefcc4aaf2db6812914afa97521d (patch) | |
tree | 8e1e6416120aea8f785e16a19e7b982b4f3670b4 | |
parent | 3b02cfab69e32f432dac4c45da9493477d7238df (diff) |
Added in stats the number of flows with risks
-rw-r--r-- | example/ndpiReader.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c index ea8ab23c5..db5e9ca70 100644 --- a/example/ndpiReader.c +++ b/example/ndpiReader.c @@ -83,7 +83,7 @@ char *_debug_protocols = NULL; u_int8_t human_readeable_string_len = 5; u_int8_t max_num_udp_dissected_pkts = 24 /* 8 is enough for most protocols, Signal and SnapchatCall require more */, max_num_tcp_dissected_pkts = 80 /* due to telnet */; static u_int32_t pcap_analysis_duration = (u_int32_t)-1; -static u_int32_t risk_stats[NDPI_MAX_RISK] = { 0 }, risks_found = 0; +static u_int32_t risk_stats[NDPI_MAX_RISK] = { 0 }, risks_found = 0, flows_with_risks = 0; static u_int16_t decode_tunnels = 0; static u_int16_t num_loops = 1; static u_int8_t shutdown_app = 0, quiet_mode = 0; @@ -2244,6 +2244,8 @@ static void node_flow_risk_walker(const void *node, ndpi_VISIT which, int depth, if(f->risk) { u_int j; + flows_with_risks++; + for(j = 0; j < NDPI_MAX_RISK; j++) { ndpi_risk_enum r = (ndpi_risk_enum)j; @@ -2266,7 +2268,7 @@ static void printRiskStats() { } if(risks_found) { - printf("\nRisk statistics:\n"); + printf("\nRisk stats (found %u flows with risks):\n", flows_with_risks); for(i = 0; i < NDPI_MAX_RISK; i++) { ndpi_risk_enum r = (ndpi_risk_enum)i; @@ -2276,8 +2278,8 @@ static void printRiskStats() { (float)(risk_stats[r]*100)/(float)risks_found); } - printf("\n\tNOTE: as one flow can have multiple risks set, the sum of\n" - "\t flows with risks can exceed the number of observed flows\n"); + printf("\n\tNOTE: as one flow can have multiple risks set, the sum of the\n" + "\t last column can exceed the number of flows with risks.\n"); printf("\n\n"); } } |