Nmap Development mailing list archives

Re: Add XML support to NSE


From: Duarte Silva <duartejcsilva () gmail com>
Date: Tue, 29 Sep 2009 23:21:18 +0100

Hi Patrick,

On Tue, Sep 29, 2009 at 8:54 PM, Patrick Donnelly <batrick () batbytes com> wrote:
Hi Duarte,

On Mon, Sep 28, 2009 at 5:28 PM, Duarte Silva <duartejcsilva () gmail com> wrote:
Hi,

The following set of patches add XML support to NSE by using Expat. To
make the code review easier I have broken the changes in three
separated files.

nse-xml-libexpat.patch - Add all the Expat source/header library files
and the Visual Studio solution file
nse-xml-solchanges.patch - Changes to Visual Studio nmap.sln and
nmap.vcproj files
nse-xml-support.patch - Files that make the bridge between NSE and Expat

Note that I only have made changes to the Windows build environment.
Because at the moment I don't have a way to test it in Linux.

Dummy usage example follows.

function startelement(parser, name, atts)
       print(name)

       for key, value in pairs(atts) do
               print(key, value)
       end
end

function endelement(parser, name)
       print(name)
end

action = function(host, port)
       local callbacks = {
               start_element = startelement,
               end_element = endelement,
       }

       local p = expat.new(callbacks)
       p:parse("<first><second property=\"test\"></second></first>")
       p:close()
end

I wanted to apologize if came off ungrateful for your hard work on the
binding you wrote for Expat. Thank you for trying to make NSE better!

Chill dude, no damage done :P

I do think that we probably will try to avoid adding a C binding for
an XML Parser. I apologize that you ended up putting so much work into
your binding only to find out we probably wouldn't use it. I will look
through your patch again; David and I may still decide to use it.

I totally agree with the point that adding another C static linked
library to nmap will only contribute to binary bloat, especially if
there is a viable *in* LUA alternative.

If we decide to not use it, we will most likely (intend to) use LPeg
for a parser. Perhaps you would like to polish one of the many LPeg
XML parsers (most of them are proof-of-concept) for NSE's use. LPeg is
very fun to work with after you get the hang of it (the home page has
many instructive examples).

Will take a look at it :) and see what I can learn with it.

I just felt compelled to learn more about nmap and LUA and its
interface because I found the learning process quite interesting and
decided to make something that could actually in some remote
possibility do something useful.

Thanks again for your hard work,

--
-Patrick Donnelly

"Let all men know thee, but no man know thee thoroughly: Men freely
ford that see the shallows."

- Benjamin Franklin


Cheers,
Duarte

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


Current thread: