Nmap Development mailing list archives

[NSE patch] port or service not matching ports


From: Sven Klemm <sven () c3d2 de>
Date: Sun, 23 Dec 2007 16:09:02 +0100

Hi everyone,

the port_or_service function in the shortport library does not match
ports because the port variable passed to portnumber is shadowed by
the variable passed during portrule check. The attached patch fixes
this behaviour.

Cheers,
Sven
Index: shortport.lua
===================================================================
--- shortport.lua       (revision 6611)
+++ shortport.lua       (working copy)
@@ -65,7 +65,7 @@
        end
 end
 
-port_or_service = function(port, _service, proto, _state)
+port_or_service = function(_port, _service, proto, _state)
        local state = _state or {"open", "open|filtered"}
        local state_table
 
@@ -77,7 +77,7 @@
 
        return function(host, port)
                for _, state in pairs(state_table) do
-                       local port_checker = portnumber(port, proto, state)
+                       local port_checker = portnumber(_port, proto, state)
                        local service_checker = service(_service, proto, state)
                        if (port_checker(host, port) or service_checker(host, port)) then
                                return true

Attachment: signature.asc
Description: OpenPGP digital signature


_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org

Current thread: