From 005a84fc5925c96f7b9c5d92908f617ac0d779a6 Mon Sep 17 00:00:00 2001 From: diman Date: Sat, 8 Dec 2007 15:28:55 +0000 Subject: [PATCH] open / open|filtered tables work for shortport.service now --- nselib/shortport.lua | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/nselib/shortport.lua b/nselib/shortport.lua index 646876c13..87b311c00 100644 --- a/nselib/shortport.lua +++ b/nselib/shortport.lua @@ -44,11 +44,19 @@ service = function(service, _proto, _state) service_table = service end + if(type(state) == "string") then + state_table = {state} + elseif(type(state) == "table") then + state_table = state + end + return function(host, port) - if(port.protocol == proto and port.state == state) then - for _, service in ipairs(service_table) do - if(port.service == service) then - return true + for _, state in pairs(state_table) do + if(port.protocol == proto and port.state == state) then + for _, service in ipairs(service_table) do + if(port.service == service) then + return true + end end end end