summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2023-08-02 20:21:53 +0200
committerToni Uhlig <matzeton@googlemail.com>2023-08-02 21:00:39 +0200
commitebb439d959c9966345e0acc10ea6fa63635b5995 (patch)
treede4366f6dc8e2d1caf880f3d73f38c7b36d3fae7 /examples
parent79834df457ebc36158c8197a26c11b672993b3ea (diff)
Tiny improvments.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/c-collectd/c-collectd.c4
-rwxr-xr-xexamples/py-flow-info/flow-info.py8
2 files changed, 6 insertions, 6 deletions
diff --git a/examples/c-collectd/c-collectd.c b/examples/c-collectd/c-collectd.c
index 624672ef3..7ab62e919 100644
--- a/examples/c-collectd/c-collectd.c
+++ b/examples/c-collectd/c-collectd.c
@@ -738,7 +738,7 @@ static enum nDPIsrvd_callback_return collectd_json_callback(struct nDPIsrvd_sock
if (str_value_to_ull(TOKEN_GET_KEY(sock, current, NULL), &numeric_risk_value) == CONVERSION_OK)
{
- if ((flow_user_data->detected_risks & (1 << numeric_risk_value)) == 0)
+ if ((flow_user_data->detected_risks & (1ull << numeric_risk_value)) == 0)
{
if (numeric_risk_value < NDPI_MAX_RISK && numeric_risk_value > 0)
{
@@ -749,7 +749,7 @@ static enum nDPIsrvd_callback_return collectd_json_callback(struct nDPIsrvd_sock
collectd_statistics.flow_risk_unknown_count++;
}
- flow_user_data->detected_risks |= (1 << (numeric_risk_value - 1));
+ flow_user_data->detected_risks |= (1ull << (numeric_risk_value - 1));
}
}
}
diff --git a/examples/py-flow-info/flow-info.py b/examples/py-flow-info/flow-info.py
index c0dd91b27..5bd865a9d 100755
--- a/examples/py-flow-info/flow-info.py
+++ b/examples/py-flow-info/flow-info.py
@@ -469,23 +469,23 @@ def onJsonLineRecvd(json_dict, instance, current_flow, global_user_data):
line_suffix += '[{}]'.format(json_dict['ndpi']['hostname'])
if args.print_bytes is True:
- if len(ndpi_proto_categ_breed) != 0 or len(line_suffix) != 0:
- line_suffix += ' '
src_color = ''
dst_color = ''
tot_color = ''
if json_dict['flow_src_tot_l4_payload_len'] >= 1 * 1024 * 1024:
tot_color = src_color = TermColor.HINT
+ if json_dict['flow_src_tot_l4_payload_len'] >= 1 * 1024 * 1024 * 1024:
+ src_color += TermColor.BOLD + TermColor.BLINK
if json_dict['flow_dst_tot_l4_payload_len'] >= 1 * 1024 * 1024:
tot_color = dst_color = TermColor.HINT
+ if json_dict['flow_dst_tot_l4_payload_len'] >= 1 * 1024 * 1024 * 1024:
+ dst_color += TermColor.BOLD + TermColor.BLINK
line_suffix += '[' + src_color + Stats.prettifyBytes(json_dict['flow_src_tot_l4_payload_len']) + TermColor.END + ']' \
'[' + dst_color + Stats.prettifyBytes(json_dict['flow_dst_tot_l4_payload_len']) + TermColor.END +']' \
'[' + tot_color + Stats.prettifyBytes(json_dict['flow_src_tot_l4_payload_len'] + \
json_dict['flow_dst_tot_l4_payload_len']) + TermColor.END + ']'
if args.print_packets is True:
- if len(ndpi_proto_categ_breed) != 0 or len(line_suffix) != 0:
- line_suffix += ' '
line_suffix += '[' + Stats.prettifyBytes(json_dict['flow_src_packets_processed'], False) + ']' \
'[' + Stats.prettifyBytes(json_dict['flow_dst_packets_processed'], False) + ']'