Home page logo
/

nmap-dev logo Nmap Development mailing list archives

Re: NMAP 2.54 Port interface question
From: William McVey <wam () cisco com>
Date: 29 May 2002 11:38:36 -0500

On Wed, 2002-05-29 at 07:59, Liam Davitt wrote:
to clarify...

How can I redirect the output of, say, a ping scan, or even just a ping, to 
another tool?  Can anyone show me a pseudocode or even a code example of how 
that is done?

I hate to be simplistic, but the easiest way to do this is simply to 
connect the processes via the tried and true commandline pipe.
This has the downside that processes on the other side of the pipe are
fully buffered (even though nmap flushes stdout every time it finishes a
host, the pipe will accumulate input until a full buffer has been
sent).   I've successfully hooked up nmap to a custom GUI using python's
popen3 function within the popen2 module with the bufsize argument set
to 1 (do line buffering).  I've also done some thing similar in C using
popen(3) and the setvbuf(3) function calls.  I unfortunately can't 
paste in the code (its intellectual property of a former employer);
however, the info to do this is in Richard Stevens' Advanced Programming
in the UNIX Environment (sections 5.4 and 14.4 have the relevant info).

I'm actually in the process of writing an NMAP module in python (similar
in concept to the recently posted perl module for nmap) that will be
able to launch nmap invocations as well as parse the results into python
accessible data structures.  Its still unfinished and buggy, but when it
firms up, I'll be releasing it under the GPL (and of course announcing
it on the nmap mailing lists).

  -- William

---------------------------------------------------------------------
For help using this (nmap-dev) mailing list, send a blank email to 
nmap-dev-help () insecure org . List run by ezmlm-idx (www.ezmlm.org).



  By Date           By Thread  

Current thread:
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]
AlienVault