Nmap Development mailing list archives

Re: Implementing Nmap within a Java Program


From: "Supratim Sarkar" <supratimsarkar () gmail com>
Date: Fri, 30 May 2008 12:29:58 +0530

Thanks for the reply Kris
About the nmap scan I am doing it only on 2 hosts. The same scan running
directly from command prompt takes around 80-90 sec ..but when I do the
execution from JAVA the XML file is not complete even after 10 min or so. In
fact the nmap process has to be killed from task manager to be able to go
forward in my java program.

As of the choice of Java..this I cant avoid now as almost all parts of the
program has been coded in it.

What I am asking for here is there anything specific in nmap that java
should take care of befor trying to execute nmap.

Regards,
Supratim

On Fri, May 30, 2008 at 3:46 AM, Kris Katterjohn <katterjohn () gmail com>
wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Supratim Sarkar wrote:
Hi everybody,

Cheers to Fyodor first for having created such a freat tool.

Now I was trying to develop a Scanner/Asset Management kind of tool with
nmap. I started on with java.(JDK 1.6) Platform is Win XP Pro.


Hi.  There are Nmap wrappers in several scripting languages (Perl, Python,
Ruby, etc) which you may be interested in using instead, unless you really
need to use Java.  But on to your problem..

The nmap cmd string is something like this :

nmap.exe -sSU -pT:*,U:53,67,161 -sV --version-light -T4-v -P0 -n -PU -oX
data.xml xx.xx.xx.xx-xx

The cmd1 string looks like

NETSCAN.exe "nmap.exe -sT -pT:*,U:53,67,161 -sV --version-light -T4-v -P0
-n
-PU -oX dataone.xml xx.xx.xx.xx-xx"

===================================================================================================================

Now the thing is that the nmap program starts as I can checkout by
running
task manager and that the xml file is also generated. But it keeps going
on
and does not terminate.Its like nmap hangs somewhere in the middle of the
scan


Are you sure that Nmap isn't just taking a while to scan?  Is the generated
XML file complete?  You're not explicit enough here :)

You're scanning 1200+ TCP ports, some UDP ports, AND you're doing a service
scan (albeit light), ALL against multiple hosts.  Have you tried something
smaller like one port on one host to rule this out?

I'm also not familiar with process creation/execution under Java, so there
may
be an issue there I'm unaware of.

It would be of great help if someone can help me out with this

Thanks,

Supratim


Thanks,
Kris Katterjohn

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQIVAwUBSD8rNf9K37xXYl36AQI1QA/9FIiL4Jax/RzrPMoKPucjtb8DVs2eRSBU
/d8UTGrHBpd6OT2ntR8uk/e3IjueVlfrYT1kDa/hs3ICdwmx/HCdTyrDFwh8GIdL
T8qj2YleycXPNDfgrIWHhApF9zswa1AW9kdMTAO3F86V3j+0V2TcNTIt620LjW7H
cbiJ6eayuBpmW4c6WpQENgkGpiFpSQe0fykoqupx1gxq1wFn3PhT2+wVaF+6uBM1
AFwJ4PCI9QhUcQ0zVHcrGp070BAHp9M6A8lIEMwvThnJqcWo2s2/tSdDNU8/JACT
IRnxDXQFxVo1KsKnslamC8tZMOmJRJT9/7kX3XOFdvyK4Fnxfeji+LHflujERWpT
7rdsE1SRF50NRVYjatgqJU1uGxFw+PulgudbqH9Q9VnsnJtYYF9U7X17A8jKSO5q
scO1gjX5bu2Cnoy0uhHRP7dHXt7GZjXq7dnSz2oGozFTd2MxoyP7rTS/1PjJEHqt
CzsdHuPz4mI/QEPEdZwKFsN8+Lp1/R/h+SKfgFTqOzioXIM+DvgBApsRW3e3wAtp
zoIjmrlsu1R6A69tHTouMHaCCQSBPM7A76u6FPuoeZ+pIiksPWcPJROFUVdW7iR8
lJ/1Zrv+xUguVgbutsfnrm9FmAfn9pVy3dEfeKYgv87BPdneRYuAfU3rB0iB8X1c
1vL5LFj2v/k=
=8IXR
-----END PGP SIGNATURE-----


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


Current thread: