Implements proper shortening in host/flow alerts

Addresses #5727
This commit is contained in:
Simone Mainardi 2021-08-03 19:39:39 +02:00
parent 94b498436c
commit d1d598e0a2
9 changed files with 47 additions and 17 deletions

View file

@ -647,7 +647,11 @@ class DataTableRenders {
}
static filterize(key, value, label, tag_label, title) {
return `<a class='tag-filter' data-tag-key='${key}' title='${title || value}' data-tag-value='${value}' data-tag-label='${tag_label || label || value}' href='#'>${label || value}</a>`;
let fmt_title = title || value;
if(fmt_title && fmt_title != value)
fmt_title = value + " [" + fmt_title + "]";
return `<a class='tag-filter' data-tag-key='${key}' title='${fmt_title}' data-tag-value='${value}' data-tag-label='${tag_label || label || value}' href='#'>${label || value}</a>`;
}
static formatValueLabel(obj, type, row) {
@ -672,7 +676,7 @@ class DataTableRenders {
html_ref = obj.reference
let label = obj.label;
label = DataTableRenders.filterize('ip', obj.value, label);
label = DataTableRenders.filterize('ip', obj.value, label, label, obj.label_full);
if (row.role && row.role.value == 'attacker')
label = label + ' ' + DataTableRenders.filterize('role', row.role.value,
@ -694,10 +698,10 @@ class DataTableRenders {
static formatFlowTuple(flow, type, row) {
let active_ref = (flow.active_url ? `<a href="${flow.active_url}"><i class="fas fa-stream"></i></a>` : "");
let cliLabel = DataTableRenders.filterize('cli_ip', flow.cli_ip.value, flow.cli_ip.label);
let cliLabel = DataTableRenders.filterize('cli_ip', flow.cli_ip.value, flow.cli_ip.label, flow.cli_ip.label, flow.cli_ip.label_full);
let cliPortLabel = ((flow.cli_port && flow.cli_port > 0) ? ":"+DataTableRenders.filterize('cli_port', flow.cli_port, flow.cli_port) : "");
let srvLabel = DataTableRenders.filterize('srv_ip', flow.srv_ip.value, flow.srv_ip.label);
let srvLabel = DataTableRenders.filterize('srv_ip', flow.srv_ip.value, flow.srv_ip.label, flow.srv_ip.label, flow.srv_ip.label_full);
let srvPortLabel = ((flow.cli_port && flow.cli_port > 0) ? ":"+DataTableRenders.filterize('srv_port', flow.srv_port, flow.srv_port) : "");
let cliIcons = "";