diff --git a/scripts/http-apache-server-status.nse b/scripts/http-apache-server-status.nse index 3e5126625..752d2d5b9 100644 --- a/scripts/http-apache-server-status.nse +++ b/scripts/http-apache-server-status.nse @@ -1,3 +1,4 @@ +local nmap = require "nmap" local shortport = require "shortport" local http = require "http" local stdnse = require "stdnse" @@ -47,7 +48,16 @@ author = "Eric Gershman" license = "Same as Nmap--See http://nmap.org/book/man-legal.html" categories = {"discovery", "safe"} -portrule = shortport.port_or_service({80, 443}, {"http","https"}, "tcp", "open") +portrule = function(host, port) + if not shortport.http(host, port) then + return false + end + if port.version and port.version.product then + return string.match(port.version.product, "Apache") + end + return true +end + action = function(host, port) -- Perform a GET request for /server-status local path = "/server-status" @@ -78,6 +88,24 @@ action = function(host, port) result["Server Uptime"] = string.match(response.body, "Server%suptime:%s*([^<]*)