1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-01 12:29:03 +00:00

Merge r18689:r19511 from /nmap-exp/djalal/nse-rules.

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.
This commit is contained in:
djalal
2010-08-06 16:40:03 +00:00
parent eb699270e9
commit f0c5e154c3
22 changed files with 403 additions and 160 deletions

View File

@@ -1918,6 +1918,35 @@ void printserviceinfooutput(Target * currenths) {
}
#ifndef NOLUA
void printscriptresults(ScriptResults * scriptResults, stype scantype) {
ScriptResults::iterator iter;
char *script_output;
if (scriptResults->size() > 0) {
if (scantype == SCRIPT_PRE_SCAN) {
xml_start_tag("prescript");
log_write(LOG_PLAIN, "Pre-scan script results:\n");
}
else {
xml_start_tag("postscript");
log_write(LOG_PLAIN, "Post-scan script results:\n");
}
for (iter = scriptResults->begin();
iter != scriptResults->end();
iter++) {
xml_open_start_tag("script");
xml_attribute("id", "%s", iter->get_id().c_str());
xml_attribute("output", "%s", iter->get_output().c_str());
xml_close_empty_tag();
script_output = formatScriptOutput((*iter));
log_write(LOG_PLAIN, "%s\n", script_output);
free(script_output);
}
xml_end_tag();
}
}
void printhostscriptresults(Target * currenths) {
ScriptResults::iterator iter;
char *script_output;