我们正尝试为Cisco AnyConnect客户端部署动态访问策略(DAP),该客户端将检查最终用户的计算机是否已安装并正在运行防病毒,防火墙是否已启动并正在运行以及是否具有某些Windows更新(KB)。 思科有一个不错的网站,以不同的脚本显示这些脚本,但是,我们希望将这三个脚本合并为一个脚本。
下面是显示用于防病毒和防火墙检查的Lua脚本的代码和网站。您能帮我将此脚本与Hotfix KB检查合并吗? https://www.cisco.com/c/en/us/support/docs/security/asa-5500-x-series-next-generation-firewalls/115947-dap-adv-functions-00.html#anc9
预先感谢
assert(function()
function checkav(antix)
if (type(antix) == "table") then
for k,v in pairs(antix) do
if (EVAL(v.activescan, "EQ", "ok", "string") and EVAL (v.lastupdate, "LT", "2592000", "integer")) then
return true
end
end
end
return false
end
function checkfw(antix)
if (type(antix) == "table") then
for k,v in pairs(antix) do
if (EVAL(v.enabled, "EQ", "ok", "string")) then
return true
end
end
end
return false
end
return (checkav(endpoint.av) and checkfw(endpoint.fw))
end)()
assert(function ()
local pattern = "KB944"
local true_on_match = true
local match = false
for k,v in pairs(endpoint.os.hotfix) do
print(k)
match = string.find(k, pattern)
if (match) then
if (true_on_match) then
return true
else return (false)
end
end
end
end)()
答案 0 :(得分:0)
前进的道路:独立的功能。然后,您可以使用逻辑and
调用断言并合并调用:
修补程序KB检查:
function hotfixKb()
local pattern = "KB944"
local true_on_match = true
local match = false
for k,v in pairs(endpoint.os.hotfix) do
print(k)
match = string.find(k, pattern)
if (match) then
if (true_on_match) then
return true
else
return (false)
end
end
end
end
防病毒检查:
function checkAntiVirus(antix)
if (type(antix) == "table") then
for k,v in pairs(antix) do
if (EVAL(v.activescan, "EQ", "ok", "string") and EVAL (v.lastupdate, "LT", "2592000", "integer")) then
return true
end
end
end
return false
end
防火墙检查:
function checkFireWall(antix)
if (type(antix) == "table") then
for k,v in pairs(antix) do
if (EVAL(v.enabled, "EQ", "ok", "string")) then
return true
end
end
end
return false
end
然后:
assert(hotfixKb() and checkAntiVirus() and checkFireWall())