-- HTTP authentication information gathering script -- rev 1.1 (2007-05-25) id = "HTTP Auth" description = "If a web server requires authentication, prints the authentication scheme and realm" author = "Thomas Buchanan " license = "See nmaps COPYING for licence" -- uncomment the following line to enable safe category -- categories = {"safe"} categories = {"intrusive"} require "shortport" portrule = shortport.port_or_service({80, 8080}, "http") action = function(host, port) local socket local catch = function() socket:close() end local try = nmap.new_try(catch) local get_http_headers = function(dst, dst_port, query_string) socket = nmap.new_socket() try(socket:connect(dst, dst_port)) try(socket:send(query_string)) local response = "" local lines local status while true do status, lines = socket:receive_lines(1) if not status then break end response = response .. lines end try(socket:close()) local tags = {"(.-)