Nmap Development mailing list archives

Re: parsing XML with NSE


From: David Fifield <david () bamsoftware com>
Date: Thu, 26 Aug 2010 14:41:02 -0600

On Tue, Aug 24, 2010 at 07:42:01PM -0400, Patrick Donnelly wrote:
On Tue, Aug 24, 2010 at 5:55 PM, DePriest, Jason R.
<jrdepriest () gmail com> wrote:
Is there an XML parser available for NSE that could take XML and turn
it in to Lua tables?

I've read http://lua-users.org/wiki/LuaXml which says that you can get
Lua to do it, but it isn't built-in.  Is something like LuaXML already
present?

On another note, it would be nice if whatever parser existed could
also handle XSLT filtes.

I was starting to work on an NSE script that can parse the NAI ePolicy
Orchestrator agent information available from port 8081 on hosts
running ePO Agent, but I don't want to duplicate work if there is a
library I can already plug in.

There most definitely is somewhere. I'll go on a search. For those
wondering, the lua-users.org site just got moved to new servers and
the DNS might not be up to speed in your area (it's not for me).

Ryan Linn, who wrote an NSE–Metasploit binding called Nsploit, used a
Lua binding of Expat called lxp. This is what's reflected at the moment
in his online repository viewer.

http://trac.happypacket.net/browser/nsploit/trunk/nselib/Nsploit.lua

However I spoke to him at the conferences in Las Vegas and he said that
he had removed the dependency on lxp. He posted some code at
http://www.happypacket.net/VegasCode2010.tar.bz2 and it looks like he
made a new library, Nxmlrpc.lua, based on the "Classic Lua-only version"
at http://lua-users.org/wiki/LuaXml.

If an XML parser can be that small and do everything we need it to, I
wouldn't hesitate to add it as a new library.

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: