Adriano Monteiro wrote: > I'm working on a script that executes a command with arbitrary > options. Most of its options works fine with subprocess, but at least > one (as far as I know) is giving me a headache. The program that I'm > trying to execute is Nmap, and the problematic option is the -iL, that > is used to indicate a file with the targets that nmap should scan. > > If I open my terminal, and write: nmap -iL "/tmp/target_list" , nmap > picks the file, read it and scan every target written inside it.
when you do this, the shell strips away the quotes and passes the strings "-iL" and "/tmp/target_list" to the nmap executable. > But, if I try to use the same scan on my command execution script, it > makes nmap raise a strange error: > > "Failed to open input file "/home/adriano/umit/test/targets" for reading > QUITTING!" subprocess does quoting itself, so those extra quotes are passed through to nmap itself. try removing them from the string literal; they're not really part of the argument value. </F> -- http://mail.python.org/mailman/listinfo/python-list