mailing list archives
Re: Suggestion: Using script output - Human-readable and machine-parseable
From: Daniel Miller <bonsaiviking () gmail com>
Date: Tue, 19 Apr 2011 07:23:48 -0500
On Mon, Apr 18, 2011 at 11:36 PM, David Fifield <david () bamsoftware com>wrote:
Do we really need to link with libyaml? It seems like emitting YAML, as
opposed to parsing it, would be easy enough to implement in stdnse.
No, we really don't, especially if we want to have an intermediate form (C++
data structure) to hand off to output.cc for XML output. I've been working
on this angle (scrapped the YAML for now), and I have a decent first go at
it. I've been using stdnse.format_output as a model, since script authors
should be used to that, and it means the least changes to existing scripts.
Here's example output:
Pre-scan script results:
| Apple pie
| Domain 1
| Domain 2
| NAMES (WARNING: Not all names could be determined!)
|_ Name 1
<prescript><script id="test"><container name=""><elem>Apple
pie</elem><container name="DOMAINS"><elem>Domain 1</elem><elem>Domain
2</elem></container><container name="NAMES" warning="Not all names could be
I'm currently in debug mode, and having a rough time. I can't get that blank
first line to go away. I know exactly which function is generating it, but
if I change the function to return a blank string instead of "\n", it
mangles the rest of the text output in a way that doesn't make any sense.
I'm also fighting with a function that returns different values based on if
there is a comment in it.
I'm attaching a patch with my current progress. I'd appreciate any input you
have at this point, but I realize it's not robust code yet.
Sent through the nmap-dev mailing list
Archived at http://seclists.org/nmap-dev/
- Re: Suggestion: Using script output - Human-readable and machine-parseable, (continued)