mirror of
https://github.com/nmap/nmap.git
synced 2025-12-08 21:51:28 +00:00
Allow http-server-header to set http service even without Server header
This commit is contained in:
@@ -30,22 +30,25 @@ action = function(host, port)
|
|||||||
local status, result = comm.tryssl(host, port,
|
local status, result = comm.tryssl(host, port,
|
||||||
"GET / HTTP/1.0\r\n\r\n",
|
"GET / HTTP/1.0\r\n\r\n",
|
||||||
{proto=port.protocol, timeout=5000})
|
{proto=port.protocol, timeout=5000})
|
||||||
|
|
||||||
if (not status) then
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
local http_server = string.match(result, "\nServer:%s*(.-)\r?\n")
|
if (not status) then
|
||||||
if http_server == nil then
|
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
port.version = port.version or {}
|
port.version = port.version or {}
|
||||||
|
|
||||||
|
if string.match(result, "^HTTP/1.[01] %d%d%d") then
|
||||||
|
port.version.service = "http"
|
||||||
|
else
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local http_server = string.match(result, "\nServer:%s*(.-)\r?\n")
|
||||||
|
|
||||||
if port.version.product == nil then
|
if port.version.product == nil then
|
||||||
port.version.product = http_server
|
port.version.product = http_server
|
||||||
end
|
end
|
||||||
nmap.set_port_version(host, port, "hardmatched")
|
nmap.set_port_version(host, port, "hardmatched")
|
||||||
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user