1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-13 11:19:02 +00:00

Add patch from Ange Gutek and Tom Sellers to make http-php-version only

consider responses with a 200 status.
This commit is contained in:
david
2010-08-10 19:54:30 +00:00
parent f46908f0bd
commit d5edc49016

View File

@@ -18,6 +18,10 @@ The script also checks if any header field value starts with
-- | Versions from credits query (more accurate): 5.0.5 -- | Versions from credits query (more accurate): 5.0.5
-- |_Version from header x-powered-by: PHP/5.0.5 -- |_Version from header x-powered-by: PHP/5.0.5
-- 08/10/2010:
-- * Added a check on the http status when querying the server:
-- if the http code is 200 (ok), proceed. (thanks to Tom Sellers who has reported this lack of check)
author = "Ange Gutek" author = "Ange Gutek"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html" license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = {"discovery", "safe"} categories = {"discovery", "safe"}
@@ -81,14 +85,14 @@ action = function(host, port)
-- 1st pass : the "special" PHP-logo test -- 1st pass : the "special" PHP-logo test
response = http.get(host, port, LOGO_QUERY) response = http.get(host, port, LOGO_QUERY)
if response.body then if response.body and response.status == 200 then
logo_hash = stdnse.tohex(openssl.md5(response.body)) logo_hash = stdnse.tohex(openssl.md5(response.body))
logo_versions = LOGO_HASHES[logo_hash] logo_versions = LOGO_HASHES[logo_hash]
end end
-- 2nd pass : the PHP-credits test -- 2nd pass : the PHP-credits test
response = http.get(host, port, CREDITS_QUERY) response = http.get(host, port, CREDITS_QUERY)
if response.body then if response.body and response.status == 200 then
credits_hash = stdnse.tohex(openssl.md5(response.body)) credits_hash = stdnse.tohex(openssl.md5(response.body))
credits_versions = CREDITS_HASHES[credits_hash] credits_versions = CREDITS_HASHES[credits_hash]
end end