aboutsummaryrefslogtreecommitdiff
path: root/example/ndpiReader.c
diff options
context:
space:
mode:
authorLuca Deri <deri@ntop.org>2019-12-09 00:11:32 +0100
committerLuca Deri <deri@ntop.org>2019-12-09 00:11:32 +0100
commit23b0b8625d1f20596b2b20a149fb28c38046f4e1 (patch)
tree18fd529aa36a7fadf27fadc17a6d445a32b65043 /example/ndpiReader.c
parent558983c99c274c122f0deb6f2e29d5eb0594a373 (diff)
Minor changes to the IDS score calculation
Diffstat (limited to 'example/ndpiReader.c')
-rw-r--r--example/ndpiReader.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c
index bbc78bf02..0193f5ce3 100644
--- a/example/ndpiReader.c
+++ b/example/ndpiReader.c
@@ -242,7 +242,7 @@ static void reduceBDbits(uint32_t *bd, unsigned int len) {
static void
flowGetBDMeanandVariance(struct ndpi_flow_info* flow) {
FILE *out = results_file ? results_file : stdout;
-
+
const uint32_t *array = NULL;
uint32_t tmp[256], i;
unsigned int num_bytes;
@@ -1008,8 +1008,7 @@ static void printFlow(u_int16_t id, struct ndpi_flow_info *flow, u_int16_t threa
ssh_patator_score = Ssh_patator_score(flow);
inf_score = Infiltration_score(flow);
-
-
+
double benign_score = dos_ge_score < 1 && dos_slow_score < 1 && \
dos_hulk_score < 1 && ddos_score < 1 && hearthbleed_score < 1 && \
ftp_patator_score < 1 && ssh_patator_score < 1 && inf_score < 1 ? 1.1 : 0;
@@ -1028,11 +1027,11 @@ static void printFlow(u_int16_t id, struct ndpi_flow_info *flow, u_int16_t threa
ndpi_protocol2name(ndpi_thread_info[thread_id].workflow->ndpi_struct,
flow->detected_protocol, buf, sizeof(buf)));
- fprintf(csv_fp, "%.9lf,%.9lf,%.9lf,%.9lf,%.9lf,%.9lf,%.9lf,%.9lf,%9.lf,", \
- benign_score, dos_slow_score, dos_ge_score, dos_hulk_score, \
- ddos_score, hearthbleed_score, ftp_patator_score, \
- ssh_patator_score, inf_score);
-
+ fprintf(csv_fp, "%.4lf,%.4lf,%.4lf,%.4lf,%.4lf,%.4lf,%.4lf,%.4lf,%.4lf,", \
+ benign_score, dos_slow_score, dos_ge_score, dos_hulk_score, \
+ ddos_score, hearthbleed_score, ftp_patator_score, \
+ ssh_patator_score, inf_score);
+
fprintf(csv_fp, "%u,%llu,%llu,", flow->src2dst_packets,
(long long unsigned int) flow->src2dst_bytes, (long long unsigned int) flow->src2dst_goodput_bytes);
fprintf(csv_fp, "%u,%llu,%llu,", flow->dst2src_packets,