1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-07 21:21:31 +00:00

Close open sockets in http-server-header

This commit is contained in:
dmiller
2018-06-28 03:43:26 +00:00
parent e4f65348cb
commit dbea852c26

View File

@@ -48,19 +48,21 @@ action = function(host, port)
end
if #responses == 0 then
-- Have to send the probe ourselves.
local status, result = comm.tryssl(host, port, "GET / HTTP/1.0\r\n\r\n")
local socket, result = comm.tryssl(host, port, "GET / HTTP/1.0\r\n\r\n")
if (not status) then
if (not socket) then
return nil
end
socket:close()
responses[1] = result
end
-- Also send a probe with host header if we can. IIS reported to send
-- different Server headers depending on presence of Host header.
local status, result = comm.tryssl(host, port,
local socket, result = comm.tryssl(host, port,
("GET / HTTP/1.1\r\nHost: %s\r\n\r\n"):format(stdnse.get_hostname(host)))
if status then
if socket then
socket:close()
responses[#responses+1] = result
end