diff --git a/CHANGELOG b/CHANGELOG index 9c89122aa..a89a42c2d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,11 @@ # Nmap Changelog ($Id$); -*-text-*- +o Added a function that was missing from http-favicon.nse. Its absence + would cause the error + http-favicon.nse:141: variable 'dirname' is not declared + when a web page specified an relative icon URL through the link + element. This bug was reported by Ron Meldau. [David] + o Fixed an error that occurred when UDP scan was combined with version scan. UDP ports would appear in the state "unknown" at the end of the scan, and in some cases an assertion failure would be raised. diff --git a/scripts/http-favicon.nse b/scripts/http-favicon.nse index b7ea93896..6be7f6f4c 100644 --- a/scripts/http-favicon.nse +++ b/scripts/http-favicon.nse @@ -81,8 +81,9 @@ action = function(host, port) icon = parseIcon( index.body ) -- if we find a pattern if icon then + local hostname = host.targetname or (host.name ~= "" and host.name) or host.ip stdnse.print_debug(1, "Got icon URL %s.", icon) - local icon_host, icon_port, icon_path = parse_url_relative(icon, host, port, root) + local icon_host, icon_port, icon_path = parse_url_relative(icon, hostname, port.number, root) if (icon_host == host.ip or icon_host == host.targetname or icon_host == (host.name ~= '' and host.name)) and @@ -122,6 +123,12 @@ action = function(host, port) return result end +local function dirname(path) + local dir + dir = string.match(path, "^(.*)/") + return dir or "" +end + -- Return a URL's host, port, and path, filling in the results with the given -- host, port, and path if the URL is relative. Return nil if the scheme is not -- "http" or "https".