Code cleanup

This commit is contained in:
Luca Deri 2023-12-02 10:14:43 +01:00
parent 6c29839492
commit 3fc50b1146
2 changed files with 7 additions and 9 deletions

View file

@ -809,7 +809,6 @@ local function update_scan_info_for_report(type_of_scan_execution, new_item, hos
local host_id = get_host_id(new_item)
-- handle hosts down list for email
if (is_down) then
info_json.hosts_down = true
local host_down = i18n("hosts_stats.page_scan_hosts.email.host_down_item", { host_id = host_id })
if (info_json) then
@ -1406,9 +1405,9 @@ local function retrieve_email_info(exec_type)
begin_epoch_t = tonumber(info_json.begin_epoch),
end_epoch_t = os.time(),
report_type = exec_type,
-- has_dicrepancy must be true only if there are new open ports or cves fixed
-- has_discrepancy must be true only if there are new open ports or cves fixed
has_discrepancy = ((info_json.new_open_ports or 0) > 0) or ((info_json.num_cve_solved or 0) > 0),
hosts_down = info_json.hosts_down_list
hosts_down_list = info_json.hosts_down_list
}
if (email_info.has_discrepancy) then
@ -1548,7 +1547,6 @@ function vs_utils.notify_scan_results(exec_type, periodicity)
local duration = 0
local duration_label = ''
if (email_info.duration ~= nil) then
duration_label = secondsToTime(email_info.duration)
end
@ -1575,13 +1573,13 @@ function vs_utils.notify_scan_results(exec_type, periodicity)
local skipped_hosts_list = ""
local no_hosts_down_br = ""
if (email_info.hosts_down) then
if (email_info.hosts_down_list ~= nil) then
local ret = ""
for k, v in pairsByKeys(email_info.hosts_down, asc) do
for k, v in pairsByKeys(email_info.hosts_down_list, asc) do
ret = ret .. k .. "\n"
end
skipped_hosts_list = i18n("hosts_stats.page_scan_hosts.email.host_down_list", { host_down_items = ret })
else
no_hosts_down_br = "</br><br>"
@ -1599,7 +1597,7 @@ function vs_utils.notify_scan_results(exec_type, periodicity)
start_date = start_date_formatted,
end_date = end_date_formatted,
})
local possible_discrepancies_info = ""
local add_br = ""