Problem calling script with arguments

Florian Lindner mailinglists at xgm.de
Tue Oct 15 13:35:44 EDT 2013


Am Dienstag, 15. Oktober 2013, 13:18:17 schrieb Michael Speer:
> >  "/usr/sbin/ftpasswd" "--hash"
> 
> You're missing a comma, and python automatically concatenates adjacent
> strings.

Damn!

Thanks!

> 
> On Tue, Oct 15, 2013 at 1:13 PM, Florian Lindner <mailinglists at xgm.de>wrote:
> > Hello,
> > 
> > I have a 3rd party perl script:
> >  head -n 1 /usr/sbin/ftpasswd
> > 
> > #!/usr/bin/perl
> > 
> > I want to write data to stdin and read from stdout:
> > 
> > proc = Popen( ["/usr/bin/perl", "/usr/sbin/ftpasswd" "--hash", "--stdin"],
> > stdout=PIPE, stdin=PIPE)
> > 
> > output, input = proc.communicate(pwd)
> > return output.strip()
> > 
> > Since pwd comes from a non-trusted source I don't want to use shell=True.
> > 
> > The arguments to the perl interpreter do not seem to right:
> > 
> > Can't open perl script "/usr/sbin/ftpasswd--hash": No such file or
> > directory
> > 
> > Adding a leading " " to "--hash" does not help.
> > 
> > How can I use that script and achieve something like
> > 
> > # echo "123" | ftpasswd --hash --stdin
> > ftpasswd: $1$8BuLAqCl$y/URBN/OCSLsKtnu8nFHH0
> > 
> > Thanks!
> > 
> > Florian
> > --
> > https://mail.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list