Interacting with a process that I ran with subprocess module

py.adriano at gmail.com py.adriano at gmail.com
Fri Jun 9 10:43:19 EDT 2006


Hi folks,

I'm trying to use the nmap runtime interaction feature while using it
with the subprocess module. For those not familiar with nmap, the
runtime interaction feature allow users to get informations about the
scan stats during the nmap execution. More at:
http://www.insecure.org/nmap/man/man-runtime-interaction.html
If someone want to try, just run nmap and try to type some keys to see
what happens. This only works with nmap 4.00 and above.

Ok.. What I've tried is shown below:

from subprocess import Popen, PIPE
nmap = Popen("nmap -T3 -A 10.0.0.1-254", stdin=PIPE, stdout=PIPE,
stderr=PIPE, shell=True, bufsize=1)

To interact with nmap, I tried:

nmap.communicate("?")

And I tried this, also:

nmap.stdin.write("?")
nmap.stdout.read()

What's wrong? Is that suposed to be this way? Is there a better way to
interact with it that I've missed? Any help is very welcome. Thanks in
advance!

Cheers!




More information about the Python-list mailing list