[TAG] Schema for nmap XML Output

Jimmy O'Regan joregan at gmail.com
Fri Mar 2 15:44:44 MSK 2007


On 20/02/07, Amit Kumar Saha <amitsaha.in at gmail.com> wrote:
> hi list
> Attached is the XML output for a Nmap scan
>

I know I've seen worse uses of XML, but I can't remember when - the
useful part is just a CSV blob. This is more compact than a 'proper'
use of XML, but it makes it harder to work with using XML tools: the
part that looks most interesting here is (in XPath)
/nmaprun/scaninfo/@services

(When I want to test simple XPath expressions, I load the XML into
Firefox and use this bookmarklet):

``
javascript:var r=prompt("Type your XPath here",
'');alert(document.evaluate(r, document, null,
XPathResult.STRING_TYPE, null).stringValue);
''

It only works when the result is simple text, but that's normally all
I want to find.

> The goal is to move Nmap XML files into a database, with a
> well-thought out DB schema. Ideally, this should work with PostgreSQL,
> MySQL, and other popular databases.
>

Um... why?

FWIW, MySQL 5.1 has the ability to import XML directly:
http://dev.mysql.com/tech-resources/articles/mysql-5.1-xml.html
http://rpbouman.blogspot.com/2006/03/importing-xml-data-into-mysql-using.html

> Please suggest a possible database schema for the same
>

How about the schema used in the XML? Or that used by nmap2sqlite (see below)

> Please point out any similar works
>

nmap2sqlite (http://search.cpan.org/~apersaud/Nmap-Parser-1.05/tools/nmap2sqlite.pl),
which comes with Nmap::Parser
(http://search.cpan.org/~apersaud/Nmap-Parser-1.05/Parser.pm)




More information about the TAG mailing list