Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news2.arglkargh.de!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Tim Daneliuk Newsgroups: comp.lang.python Subject: Re: Quotation Ugliness Date: Wed, 26 Nov 2014 09:36:47 -0600 Organization: A noiseless patient Spider Lines: 28 Message-ID: <5475F38F.5010501@tundraware.com> References: <54756D5F.4040806@tundraware.com> <20141126082606.281ff681@bigbox.christie.dr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: mx02.eternal-september.org; posting-host="d887b3e675279b69468e57e74ea1dcb8"; logging-data="8383"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/wNCLxFMfLtsGWSqhiJdZAv+I9+ZM8RkM=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 In-Reply-To: Cancel-Lock: sha1:zml2Q9ZSQIIco4eCrwpuILG9AsI= Xref: csiph.com comp.lang.python:81587 On 11/26/2014 09:09 AM, Chris Angelico wrote: > On Thu, Nov 27, 2014 at 2:07 AM, Chris Angelico wrote: >> I was searching the ol' memory banks, trying to figure out if there >> was some way to tell the internal 'echo' command to use slash instead >> of dash (maybe for DOS/Windows people??), in which case that would be >> parsed as "echo -- hello" and would indeed simply echo "hello". > > Speaking of which, it's entirely possible to have a "-sudo" parameter > to a command (which would be "-s -u -d -o" to many programs), so > that's another way to get a false positive. > > ChrisA > Yeah, there is no foolproof way to do this short of implementing a parser that acts exactly as the shell itself would when parsing the command line. The more I think about this, the more I think I am just going to look for the string 'sudo' anywhere in the argument. This merely will force the user to enter their sudo password if detected. If it turns out to be a false positive, no harm will be done and the password will just go unused. Thanks for the feedback. ---------------------------------------------------------------------------- Tim Daneliuk tundra@tundraware.com PGP Key: http://www.tundraware.com/PGP/