mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 15:39:33 +00:00
[VS] Add scanned hosts number in report.
This commit is contained in:
parent
931f922d80
commit
154e4095c0
2 changed files with 38 additions and 10 deletions
|
|
@ -686,6 +686,12 @@ local function update_periodicity_or_all_scan_info(is_periodic, new_item)
|
|||
end
|
||||
end
|
||||
|
||||
if (info_json ~= {} and info_json.scanned_hosts ~= nil) then
|
||||
info_json.scanned_hosts = tonumber(info_json.scanned_hosts) + 1
|
||||
else
|
||||
info_json.scanned_hosts = 1
|
||||
end
|
||||
|
||||
if (info_json ~= {} and info_json.begin_epoch == nil) then
|
||||
info_json.begin_epoch = os.time()
|
||||
end
|
||||
|
|
@ -945,23 +951,35 @@ local function format_num_for_email(num, case)
|
|||
if (num == 0) then
|
||||
return(i18n("hosts_stats.page_scan_hosts.email.no_cves"))
|
||||
else
|
||||
return(i18n("hosts_stats.page_scan_hosts.email.num_cves", {num = num}))
|
||||
local formatted_num = format_high_num_value_for_tables({num = num}, "num")
|
||||
return(i18n("hosts_stats.page_scan_hosts.email.num_cves", {num = formatted_num}))
|
||||
end
|
||||
elseif (case == 1) then
|
||||
-- udp
|
||||
if (num == 0) then
|
||||
return(i18n("hosts_stats.page_scan_hosts.email.no_udp"))
|
||||
else
|
||||
return(i18n("hosts_stats.page_scan_hosts.email.num_udp", {num = num}))
|
||||
local formatted_num = format_high_num_value_for_tables({num = num}, "num")
|
||||
return(i18n("hosts_stats.page_scan_hosts.email.num_udp", {num = formatted_num}))
|
||||
end
|
||||
elseif (case == 2) then
|
||||
-- tcp
|
||||
if (num == 0) then
|
||||
return(i18n("hosts_stats.page_scan_hosts.email.no_tcp"))
|
||||
else
|
||||
return(i18n("hosts_stats.page_scan_hosts.email.num_tcp", {num = num}))
|
||||
local formatted_num = format_high_num_value_for_tables({num = num}, "num")
|
||||
return(i18n("hosts_stats.page_scan_hosts.email.num_tcp", {num = formatted_num}))
|
||||
end
|
||||
|
||||
elseif (case == 3) then
|
||||
-- scanned_hosts
|
||||
|
||||
if (num == 0) then
|
||||
return(i18n("hosts_stats.page_scan_hosts.email.no_scanned_hosts"))
|
||||
else
|
||||
local formatted_num = format_high_num_value_for_tables({num = num}, "num")
|
||||
return(i18n("hosts_stats.page_scan_hosts.email.num_scanned_hosts", {num = formatted_num}))
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -992,6 +1010,7 @@ function vs_utils.notify_end_periodicity_or_all_scan(is_periodic, periodicity)
|
|||
local cve_num = tonumber(info_json.cves) or 0
|
||||
local udp_ports = tonumber(info_json.udp_ports) or 0
|
||||
local tcp_ports = tonumber(info_json.tcp_ports) or 0
|
||||
local scanned_hosts = tonumber(info_json.scanned_hosts) or 0
|
||||
|
||||
local title = i18n("hosts_stats.page_scan_hosts.email.vulnerability_scan_report_title",{host = getHttpHost()})
|
||||
local duration = 0
|
||||
|
|
@ -1014,6 +1033,7 @@ function vs_utils.notify_end_periodicity_or_all_scan(is_periodic, periodicity)
|
|||
cves = format_num_for_email(cve_num,0),
|
||||
udp_ports = format_num_for_email(udp_ports,1),
|
||||
tcp_ports = format_num_for_email(tcp_ports,2),
|
||||
scanned_hosts = format_num_for_email(scanned_hosts, 3),
|
||||
url = getHttpHost() .. ntop.getHttpPrefix() .. "/lua/pro/reportng.lua?report_template=vs_result",
|
||||
duration = duration_label,
|
||||
start_date = start_date_formatted,
|
||||
|
|
@ -1024,6 +1044,7 @@ function vs_utils.notify_end_periodicity_or_all_scan(is_periodic, periodicity)
|
|||
cves = format_num_for_email(cve_num,0),
|
||||
udp_ports = format_num_for_email(udp_ports,1),
|
||||
tcp_ports = format_num_for_email(tcp_ports,2),
|
||||
scanned_hosts = format_num_for_email(scanned_hosts, 3),
|
||||
url = getHttpHost() .. ntop.getHttpPrefix() .. "/lua/pro/reportng.lua?report_template=vs_result",
|
||||
duration = duration_label,
|
||||
start_date = start_date_formatted,
|
||||
|
|
@ -1035,10 +1056,12 @@ function vs_utils.notify_end_periodicity_or_all_scan(is_periodic, periodicity)
|
|||
cves = format_num_for_email(cve_num,0),
|
||||
udp_ports = format_num_for_email(udp_ports,1),
|
||||
tcp_ports = format_num_for_email(tcp_ports,2),
|
||||
scanned_hosts = format_num_for_email(scanned_hosts, 3),
|
||||
url = getHttpHost() .. ntop.getHttpPrefix() .. "/lua/pro/reportng.lua?report_template=vs_result",
|
||||
duration = duration_label,
|
||||
start_date = start_date_formatted,
|
||||
end_date = end_date_formatted
|
||||
end_date = end_date_formatted,
|
||||
|
||||
})
|
||||
end
|
||||
|
||||
|
|
@ -1048,7 +1071,8 @@ function vs_utils.notify_end_periodicity_or_all_scan(is_periodic, periodicity)
|
|||
cves = 0,
|
||||
udp_ports = 0,
|
||||
tcp_ports = 0,
|
||||
begin_epoch = 0
|
||||
begin_epoch = 0,
|
||||
scanned_hosts = 0
|
||||
}))
|
||||
end
|
||||
|
||||
|
|
@ -1478,7 +1502,8 @@ function vs_utils.schedule_all_hosts_scan()
|
|||
cves = 0,
|
||||
udp_ports = 0,
|
||||
tcp_ports = 0,
|
||||
begin_epoch = os.time()
|
||||
begin_epoch = os.time(),
|
||||
scanned_host = 0
|
||||
}))
|
||||
|
||||
return true
|
||||
|
|
@ -1515,7 +1540,8 @@ function vs_utils.schedule_periodic_scan(periodicity)
|
|||
cves = 0,
|
||||
udp_ports = 0,
|
||||
tcp_ports = 0,
|
||||
begin_epoch = os.time()
|
||||
begin_epoch = os.time(),
|
||||
scanned_hosts = 0
|
||||
}))
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue