o Add two new Script scan phases:
Script Pre-scanning phase: before any Nmap scan operation, activated by the new "prerule".
Script Post-scanning phase: after all Nmap scan operations, activated by the new "postrule".
o New environment variables:
SCRIPT_PATH
SCRIPT_NAME
SCRIPT_TYPE: the type of the rule that activated the script.
I copied parse_url_relative from favicon-survey.nse. Ron Meldau reported
that this error is raised:
http-favicon.nse:141: variable 'dirname' is not declared
It happens when a web page specifies a relative icon URL in a link
element. (dirname is used to absolutize the URL.)
Also, I changed to code to be sure to pass a plain string and number for
the host and port to parse_url_relative. Otherwise parse_url_relative
may return the tables that it receives and complicate the matching code
to decide if a URL should be followed.
try /favicon.ico if that fails. If the favicon.uri script arg is given,
only try that. Use more robust parsing to find the <link> element; in
particular, be case insensitive.
discussion on nmap-dev about how best to handle these. I also updated the docs and
am about to regenerate script.db. See this thread for more info:
http://seclists.org/nmap-dev/2009/q3/1008.html