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


Groups > comp.lang.python > #105009

Re: Obfuscating Python code

Path csiph.com!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!bcyclone01.am1.xlned.com!bcyclone01.am1.xlned.com!newsreader4.netcologne.de!news.netcologne.de!fu-berlin.de!uni-berlin.de!not-for-mail
From Daniel Wilcox <dmw@yubasolutions.com>
Newsgroups comp.lang.python
Subject Re: Obfuscating Python code
Date Tue, 15 Mar 2016 23:40:57 -0700
Lines 70
Message-ID <mailman.196.1458129721.12893.python-list@python.org> (permalink)
References <570f76f8-1e4a-421f-b1ff-4fba72f06a56@googlegroups.com> <mailman.155.1458020722.12893.python-list@python.org> <6849887.F7PvubJjsv@PointedEars.de> <mailman.167.1458073875.12893.python-list@python.org> <1577402.lMk4FsjPMl@PointedEars.de>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
X-Trace news.uni-berlin.de 57TMGbYR8ZWEhuqH5lbo6AnvAhRcYFF2+LkECzacVrgg==
Return-Path <dmw@yubasolutions.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; '16,': 0.03; 'open-source': 0.04; 'subject:Python': 0.05; 'source.': 0.05; 'distributing': 0.07; 'subject:code': 0.07; 'cc:addr:python-list': 0.09; 'variants': 0.09; 'python': 0.10; 'assume': 0.11; 'accordingly.': 0.13; 'files.': 0.13; 'do,': 0.15; 'wed,': 0.15; 'file,': 0.15; '.py': 0.16; '2.1.1': 0.16; '2016': 0.16; 'bytecode': 0.16; 'nightmare': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'stuff.': 0.16; 'substitute': 0.16; 'wrote:': 0.16; 'community,': 0.18; '&gt;': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'otherwise,': 0.20; 'forms.': 0.22; 'gcc': 0.22; 'cc:no real name:2**0': 0.22; 'am,': 0.23; 'code.': 0.23; '(or': 0.23; 'proprietary': 0.23; 'header:In-Reply-To:1': 0.24; 'software.': 0.25; 'chris': 0.26; 'point.': 0.27; 'least': 0.27; 'message- id:@mail.gmail.com': 0.27; 'restrict': 0.27; 'said,': 0.27; "skip:' 10": 0.28; 'device': 0.28; 'there.': 0.30; 'twitter:': 0.30; 'url:mailman': 0.30; 'code': 0.30; '15,': 0.30; 'task': 0.30; 'everyone': 0.31; 'anyone': 0.32; "can't": 0.32; 'skip:_ 10': 0.32; 'software,': 0.32; 'source': 0.33; 'url:python': 0.33; 'usually': 0.33; 'open': 0.33; 'url:listinfo': 0.34; 'tue,': 0.34; 'file': 0.34; 'running': 0.34; 'received:google.com': 0.35; 'world,': 0.35; 'could': 0.35; 'newer': 0.35; 'community': 0.36; 'should': 0.36; 'there': 0.36; 'url:org': 0.36; 'received:209.85': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'starting': 0.37; 'doing': 0.38; 'difference': 0.38; 'received:209': 0.38; 'mean': 0.38; 'means': 0.39; 'why': 0.39; 'does': 0.39; 'url:mail': 0.40; 'some': 0.40; 'software': 0.40; 'easy': 0.60; 'your': 0.60; 'no.': 0.62; 'programs': 0.62; 'back': 0.62; 'per': 0.62; 'yes': 0.62; 'here.': 0.62; 'providing': 0.62; 'making': 0.62; 'service.': 0.63; 'thomas': 0.63; 'more': 0.63; 'between': 0.65; 'mar': 0.65; 'reverse': 0.66; 'talking': 0.67; 'e-mail.': 0.67; "today's": 0.69; '*if': 0.84; 'engineered': 0.84; 'way)': 0.84; 'careful': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=yubasolutions-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=qOVBrd1DCB1X3bLRUaOvmUgmHMHn1bewtFOc+UlRC7g=; b=E1hHxv0gG4wceETUHGdXxqxndNCYoiAbbZEMJquwe8kdgImLXlFbTVZYs/mZX74FOX jbTZuwgKewo6V2mPWRhQD4DfG1LbI85urmazIuCTBEb+8BxhsJR02up5gm6Le6G5ESxw OrG6adroSFlTTKxp8fOLLTYnyc9oahlYl4cNtCRvIo+peYWAoFBudNpb7kCKqez+Ll6V NkGl3IFNWQ6DMtfg7Usj+ZWhTPCdbO+SU34lYZehga0Yve9G9xNR/B1RrRCv08fzxx2t fNEK8ssQXWPlT8D1CnBsvg5kZFRbtgGmYXWsy6Gsgcdrme1tuILWVMGtM5jaAgjgqKJu tHrQ==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=qOVBrd1DCB1X3bLRUaOvmUgmHMHn1bewtFOc+UlRC7g=; b=EoYjG/sYc0m4nQ2V7BqYhyiXI/9WokoLfWkj5m8TrdiR5yR5aLHJDObzb8sLErbiis y3IkJ7hhPV0n34F5VMOpmfFhbFMoUwPHKfoNB+q28nOPIdJ37U/z7a56jBUjPL4wQw/+ khmFf/Vwy/7jf3bHrYzPCNrd8QpTteGUV9Mmt8cy0pTs9oiTgWCaNw8DQwir/+Q+pAGf wfagEBpA2V19kFDCOuxIezrTUGV3tZlG4HZ8I2CcDrrg43HHWb53ddvJCrgCKt6Mj9g9 jPATDJdN/fzJX870gZWL3Oav20oKgkazkPem8sKwlB6jr9JW826oTJBOmVc+reyx0hHy DD9w==
X-Gm-Message-State AD7BkJIc5sERAOl5pZXvR7RBNEqBeFrv+L6VMl+Ek9Cq8CkE/Jf9vtWqfmZeCduOew65gqr6PpcpVOBXGEVG1rGg
X-Received by 10.25.80.1 with SMTP id e1mr540231lfb.165.1458110487124; Tue, 15 Mar 2016 23:41:27 -0700 (PDT)
X-Originating-IP [98.207.0.136]
In-Reply-To <1577402.lMk4FsjPMl@PointedEars.de>
X-Mailman-Approved-At Wed, 16 Mar 2016 08:01:59 -0400
X-Content-Filtered-By Mailman/MimeDel 2.1.21
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
X-Received-Bytes 7706
X-Received-Body-CRC 806203149
Xref csiph.com comp.lang.python:105009

Show key headers only | View raw


If you really want to learn about obfuscating python bytecode so it can't
be reverse engineered (easily) -- there are people who are doing it.
Search for 'pyasm' on github as a starting point.  tldr; yes people are
patching .pyc files. yes you can make them a nightmare to disassemble. and
yes it slows down your code.

=D

also yes, you can be tricked into running a patched .pyc file that has
nothing to do with your .py file, you have been warned.  be careful out
there.

On Tue, Mar 15, 2016 at 2:51 PM, Thomas 'PointedEars' Lahn <
PointedEars@web.de> wrote:

> Chris Angelico wrote:
>
> > On Wed, Mar 16, 2016 at 5:59 AM, Thomas 'PointedEars' Lahn
> > <PointedEars@web.de> wrote:
> >> That said, not distributing the source code of a program as well (or at
> >> least making it available to users in some way) strikes me as unpythonic
> >> since Python is at least Open Source software, and Python 2.0.1, 2.1.1
> >> and newer are GPL-compatible Free Software.
> >
> > gcc is also free software. Does that mean that all C programs should
> > be free software? No.
>
> IMNSHO, yes.  At the very least because in using gcc you benefited from the
> free software community, so you should give back to the free software
> community accordingly.
>
> > However, since all software can be reverse-compiled (particularly
>
> You mean _decompiled_.
>
> > byte-code like .pyc files),
>
> Yes, it is easier with bytecode *if you know the VM*.
>
> > the only truly reliable way to make completely closed software is to
> > restrict access to it in all forms.
>
> ACK.
>
> > In today's world, that usually means providing it as a web service.
>
> ACK.  That’s why RMS calls it SaaSS, Service as a Software Substitute :)
>
> > Otherwise, you have to assume that anyone can see your source. The
> > only difference between open-source and closed-source is the license,
> > not the ability to see stuff.
>
> If that were the case and reverse engineering were an easy task that
> everyone could do, we would have a lot more free software variants of
> proprietary software.  Particularly, we would have a lot less proprietary
> device drivers.  ISTM that you do not know what you are talking about here.
>
> --
> PointedEars
>
> Twitter: @PointedEars2
> Please do not cc me. / Bitte keine Kopien per E-Mail.
> --
> https://mail.python.org/mailman/listinfo/python-list
>

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


Thread

Is there a way to create a shared object file using PyInstaller? Swanand Pashankar <swanand.pashankar@gmail.com> - 2016-03-14 22:35 -0700
  Obfuscating Python code (was: Is there a way to create a shared object file using PyInstaller?) Ben Finney <ben+python@benfinney.id.au> - 2016-03-15 16:45 +1100
    Re: Obfuscating Python code Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-03-15 19:59 +0100
      Re: Obfuscating Python code Chris Angelico <rosuav@gmail.com> - 2016-03-16 07:31 +1100
        Re: Obfuscating Python code Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-03-15 22:51 +0100
          Re: Obfuscating Python code Daniel Wilcox <dmw@yubasolutions.com> - 2016-03-15 23:40 -0700
      Re: Obfuscating Python code Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-03-16 18:04 +1100
        Re: Obfuscating Python code Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-03-16 07:55 -0400

csiph-web