mirror of
https://github.com/nmap/nmap.git
synced 2025-12-09 14:11:29 +00:00
Close open sockets in http-server-header
This commit is contained in:
@@ -48,19 +48,21 @@ action = function(host, port)
|
|||||||
end
|
end
|
||||||
if #responses == 0 then
|
if #responses == 0 then
|
||||||
-- Have to send the probe ourselves.
|
-- 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
|
return nil
|
||||||
end
|
end
|
||||||
|
socket:close()
|
||||||
responses[1] = result
|
responses[1] = result
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Also send a probe with host header if we can. IIS reported to send
|
-- Also send a probe with host header if we can. IIS reported to send
|
||||||
-- different Server headers depending on presence of Host header.
|
-- 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)))
|
("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
|
responses[#responses+1] = result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user