Nmap Development mailing list archives

NSE structured output--normal output formatting


From: David Fifield <david () bamsoftware com>
Date: Thu, 19 Jul 2012 15:49:30 -0700

We have discussed how scripts should be able to return a table with nice
structured semantic fields, and also the need to provide less robotic
output for humans reading -oN.

We've discussed some possible options for producing normal output. These
include
* requiring the script to give to NSE a function that converts its
  output table to a string,
* requiring the script to annotate its returned table with metadata that
  describe how the table should be converted to a string, and
* returning a string along with the table.

I want to strongly suggest that we adopt the technique of just returning
string alongside the table. These are the benefits I see to this approach:

* Lower complexity.
* Every existing script is already capable of producing such a string.
* Lower complexity.
* Scripts know their own verbosity and already tailor their output for it.
* Lower complexity.

Old scripts that don't understand structured output will do

        return my_output_string

New scripts that don't need any fancy formatting will do

        return my_output_table

Scripts that need to control their normal output will do

        return my_output_table, my_output_string

What say you?

David Fifield
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: