Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #86213

Re: bufsize must be an integer in subprocess.Popen

References <CAEMktPXksS9bVaf-BQMTe5KYOu3SxbiSCWdk78S1yP0zy9DG6Q@mail.gmail.com>
Date 2015-02-23 23:42 +1100
Subject Re: bufsize must be an integer in subprocess.Popen
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.19068.1424695363.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Mon, Feb 23, 2015 at 11:13 PM, Robert Clove <cloverobert@gmail.com> wrote:
> proc1=subprocess.Popen("/root/Desktop/abc.py","64","abc",shell=True,stdout=subprocess.PIPE,
> stderr=subprocess.PIPE)

As others have said, you need to use either a single command or a list
of strings. But why are you using shell=True here? You appear to be
invoking one single script, and not needing shell features at all.
Additionally, it seems highly likely that you're running this as root
(the /root directory is usually the root user's home dir, and is
readable by nobody else), so any sort of shell injection exploit could
easily result in an attacker getting full root access to your box. I
strongly suggest using shell=False here.

ChrisA

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: bufsize must be an integer in subprocess.Popen Chris Angelico <rosuav@gmail.com> - 2015-02-23 23:42 +1100

csiph-web