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


Groups > comp.lang.python > #72473

Re: Obfuscated Python hack

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Gregory Ewing <greg.ewing@canterbury.ac.nz>
Newsgroups comp.lang.python
Subject Re: Obfuscated Python hack
Date Tue, 03 Jun 2014 17:40:38 +1200
Lines 33
Message-ID <bv55emFcik2U1@mid.individual.net> (permalink)
References <538c69d5$0$29978$c3e8da3$5496439d@news.astraweb.com> <mailman.10557.1401712081.18130.python-list@python.org>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Trace individual.net Zq0UAkxpzFPjJF6X7OlS6wEAadIk4LYoqi5S9103LAeeNY3osR
Cancel-Lock sha1:sfy6nMrND8jkqWwReofRg1DCang=
User-Agent Mozilla Thunderbird 1.0.5 (Macintosh/20050711)
X-Accept-Language en-us, en
In-Reply-To <mailman.10557.1401712081.18130.python-list@python.org>
Xref csiph.com comp.lang.python:72473

Show key headers only | View raw


Tim Chase wrote:
> Stripping off the exec() call makes it pretty transparent that you're
> attempting (successfully on some platforms) to set the value of "4"
> to "5".

But you have to do that in *another* Python session, because
the first one is broken in interesing ways, e.g.

 >>> (lambda *fs: reduce(lambda f, g: lambda x: f(g(x)), fs))(*([lambda s: 
s[1::2]+s[-2::-2]]*54))('motcye;cye._n8fo_drs(d4+)vle=5  ua.8)(isedamr.ticspt 
spt rpi')
   File "<stdin>", line 1
SyntaxError: name 'fs' is local and global

 >>> lambda z: 42
   File "<stdin>", line 1
SyntaxError: name 'z' is local and global

I never knew that error message existed! Is it even possible
to get it from a non-broken Python?

To answer my own question, apparently yes:

 >>> def f(x):
...  global x
...
   File "<stdin>", line 1
SyntaxError: name 'x' is local and global

You learn something every day...

-- 
Greg

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


Thread

Obfuscated Python hack Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-06-02 12:11 +0000
  Re: Obfuscated Python hack Tim Chase <python.list@tim.thechases.com> - 2014-06-02 07:27 -0500
    Re: Obfuscated Python hack Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-06-03 17:40 +1200
  Re: Obfuscated Python hack Chris Angelico <rosuav@gmail.com> - 2014-06-02 23:23 +1000
    Re: Obfuscated Python hack Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-06-02 15:38 +0000
      Re: Obfuscated Python hack Ian Kelly <ian.g.kelly@gmail.com> - 2014-06-02 09:47 -0600
      Re: Obfuscated Python hack Chris Angelico <rosuav@gmail.com> - 2014-06-03 01:55 +1000
      Re: Obfuscated Python hack Chris Angelico <rosuav@gmail.com> - 2014-06-03 01:56 +1000

csiph-web