mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 07:29:32 +00:00
[VS] Add ClickHouse feedback and toast, and refactor the update of the last saved result.
This commit is contained in:
parent
4a1b2b758c
commit
8ccaa28f37
8 changed files with 56 additions and 9 deletions
|
|
@ -283,15 +283,16 @@ end
|
|||
|
||||
-- ##############################################
|
||||
|
||||
local function save_last_result(scan_result, scan_type,host,epoch)
|
||||
local function save_last_result(scan_result, scan_type, host, epoch, last_port_scanned_label)
|
||||
|
||||
if(scan_result ~= nil and not ntop.isClickHouseEnabled()) then
|
||||
local handle = io.open(get_report_path(scan_type, host), "a")
|
||||
local result = handle:write("\n"..i18n("hosts_stats.page_scan_hosts.inconsistency_state").."\n"..scan_result)
|
||||
local result = handle:write("\n\n"..i18n("hosts_stats.page_scan_hosts.inconsistency_state", {port = last_port_scanned_label}).."\n"..scan_result)
|
||||
handle:close()
|
||||
end
|
||||
|
||||
if (scan_result ~= nil and ntop.isClickHouseEnabled()) then
|
||||
vs_db_utils.update_last_result(scan_result, scan_type, host, epoch)
|
||||
vs_db_utils.update_last_result(scan_result, scan_type, host, epoch, last_port_scanned_label)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -308,7 +309,10 @@ local function verify_status_ports(possible_changed_ports, host, scan_type, open
|
|||
end
|
||||
for _,possible_changed_port in ipairs(possible_changed_ports) do
|
||||
local now,result,duration,scan_result,num_open_ports,num_vulnerabilities_found, cve, udp_ports, tcp_ports = scan_module:scan_host(host, possible_changed_port)
|
||||
save_last_result(result, scan_type, host, epoch)
|
||||
|
||||
local scan_type_label = ternary(scan_type == "tcp_portscan", "tcp", "udp")
|
||||
local port_label_for_vs_result = string.format("%u/%s",possible_changed_port,scan_type_label)
|
||||
save_last_result(result, scan_type, host, epoch, port_label_for_vs_result)
|
||||
if debug_me then
|
||||
tprint("SCANNED AGAIN HOST: "..host.." ON PORT: "..possible_changed_port)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue