Well... I found pexpect as you said, but I also found that it doesn't work on windows. I need a cross-platform solution, as the program is going to run on several operating systems. Any other sugestion?
Cheers! Diez B. Roggisch wrote: > [EMAIL PROTECTED] schrieb: > > 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! > > Programs that interact with users usually require a terminal to be run > from. This is not the case when using pipes. Use pexpect. > > Diez -- http://mail.python.org/mailman/listinfo/python-list