Implemented Utils::execCmd for avoiding lua popen

Refreshed VS modules
This commit is contained in:
Luca Deri 2023-09-20 12:23:51 +02:00
parent 4f3546cf81
commit 72aee7ffab
8 changed files with 127 additions and 58 deletions

View file

@ -912,12 +912,9 @@ function vs_utils.get_active_hosts(host, cidr)
local s = string.split(host, '%.')
local net = s[1].."."..s[2].."."..s[3].."."
local command = 'nmap -sP -n ' .. net .. '1-254 | grep "Nmap scan report for" | cut -d " " -f 5'
local handle = io.popen(command)
local out = handle:read("*a")
local out = ntop.execCmd(command)
local l = lines(out)
handle:close()
for _,h in pairs(l) do
result[#result+1] = h
end