Nmap Development mailing list archives

Re: XML structured output key names


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

On Fri, Jun 29, 2012 at 05:00:40PM -0500, Daniel Miller wrote:
I think I'd prefer if everything was converted into the structured XML
format without having to opt-in (I might regret that once I see the output
from some scripts). The ssl-cert output shown at the wiki seems to magically
convert the string "Not valid before" to "notBefore" (I haven't looked at
the code yet to see how this is done, but I assume something's hardcoded in
an updated ssl-cert script). I presume that means other scripts (e.g.
smb-os-discovery) wouldn't automatically produce nice structured XML output
using the current code until someone adds the same sort of opt-in
information (e.g. "Computer name" to "computerName")? Is it possible to
automatically create the keys (e.g. camelCase).
That particular example was a mock-up, and not actually output by
any existing patch. David favors the camelCase key format, or at
least one that results in a valid identifier in Lua.

No, I really dislike camel case, including in this instance. But what I
was trying to show in this example was a straightforward table
representation of what sslcert.getCertificate returns, which has camel
case keys because that's what OpenSSL gives us
(http://www.openssl.org/docs/crypto/OBJ_nid2obj.html#NOTES).

Nor do I think being a Lua identifier is important. Having dashes in
keys, for example, could be convenient. But I do think that we should
stick to things that are recognizably keys, and not things that look
like English text. For that reason "computername" and "computer_name"
and "computer-name" and "computerName" are better than "Computer name"
and "Computer Name". This output is supposed to be *machine-readable*,
and people shouldn't have to remember whether words are capitalized or
separated with spaces or what.

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: