Nmap Development mailing list archives

Re: Java API for NMap


From: Giorgio Zoppi <giorgio.zoppi () gmail com>
Date: Wed, 19 May 2010 19:09:31 +0200

I recommend looking at the APIs of the Perl and Ruby interfaces to Nmap.
These have already been tested by some real-world use.

http://nmap.org/book/output-formats-xml-with-perl.html
http://sourceforge.net/projects/nmap-scanner/
http://anthonypersaud.com/category/nmap-parser/
http://rubynmap.sourceforge.net/
Currently there's an other valuable option.
 As far i know Zenmap it's written in python and there are some python
modules (i.e
http://nmap.org/svn/zenmap/zenmapCore/NmapCommand.py) which are used
to instruct nmap (correct me David if i'm wrong).
An option could be Jepp - http://jepp.sourceforge.net/ which embeds
CPython in Java and then you could use that module.
- For a pure Java option you might use (just sketching one possible solution):
String processExe;
Runtime runtime = Runtime.getRuntime()
processExe = "/usr/bin/nmap"
/* cmdarray is an array which contains the nmap options, see the doc*/
cmdarray[0] = processExe
cmdarray[1] = .......
etc.
runtime.exec(cmdarray)

and then parse the xml results with your DOM or SAX parser.
Unfortunately Nmap currently don't have a frontend C API, so using
Java JNI is not a possible solution to your problem.
Just 1c,
Giorgio.
-- 
Quiero ser el rayo de sol que cada día te despierta
para hacerte respirar y vivir en me.
"Favola -Moda".
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: