Skip to main content
Image of Phaistos Disc

The famous Phaistos Disc from Crete, obfuscation unbroken after thousands of years.

Opy will obfuscate your extensive, real world, multi module Python source code for free! And YOU choose per project what to obfuscate and what not, by editing the config file:

  • You can recursively exclude all identifiers of certain modules from obfuscation.

  • You can exclude human readable configuration files containing Python code.

  • You can use getattr, setattr, exec and eval by excluding the identifiers they use.

  • You can even obfuscate module file names and string literals.

  • You can run your obfuscated code from any platform.

Bugs fixed:

  • erroneous copying of directories above project root fixed

  • name of __init__.py files now left unaltered by default

  • module directories renamed appropriately

  • .pyc files not copied to target directory tree anymore. N.B. Delete them from your existing target trees since they break obfuscation!

  • from __future__ import now handled correctly

Bug reports and feature requests are most welcome and will be taken under serious consideration on a non-committal basis

What’s new:

  • license changed from QQuickLicense to Apache 2.0

  • empty lines are removed

Installation:

  • Download and unzip Opy into an arbitrary directory of your computer.

  • You only need the files opy.py and py_config.txt. They are in the opy subdirectory of your unzipped Opy version.

  • Put opy.py or a script to launch it in the path of your OS, or simply copy opy.py to the topdirectory of your project.

Use:

  • For safety, backup your sourcecode and valuable data to an off-line medium.

  • Put a copy of opy_config.txt in the top directory of your project.

  • Adapt it to your needs according to the remarks in opy_config.txt.

  • This file only contains plain Python and is exec’ed, so you can do anything clever in it.

  • Open a command window, go to the top directory of your project and run opy.py from there.

  • If the topdirectory of your project is e.g. ../work/project1 then the obfuscation result wil be in ../work/project1_opy.

  • Further adapt opy_config.txt until you’re satisfied with the result.

  • Type ‘opy ?’ or ‘python opy.py ?’ (without the quotes) on the command line to display a help text and a reference to the licence.

Important remark:

  • Obfuscate your Python code only when stricktly needed. Freedom is one of the main benefits of the Python community. In line with this the source of Opy is not obfuscated.

Example of obfuscated code:

import Tkinter as l1111lll1
import tkFileDialog
import os

from util import *

from l1l111l import *
from l1llll1 import *

l1l1lll1l1l1 = 35
l1l11l1ll1 = 16

class l111l1l111l (l1111lll1.Frame, l1lll11ll1):
        def __init__ (self, parent):
                l1111lll1.Frame.__init__ (self, parent)
                l1lll11ll1.__init__ (self)

                self.l1l1ll11llll = []

                self.l1l1ll11llll.append (l1111lll1.Frame (self, width = l1l1llll1111, height = l1l11l111l))
                self.l1l1ll11llll [-1] .pack (side = l1llll (u'ࡶࡲࡴࠬ'))

                self.l1l1ll1ll11l = l1111lll1.LabelFrame (self, text = l1llll (u'ࡒࡦࡵࡤࡱࡵࡲࡩ࡯ࡩ࠸'), padx = 5)
                self.l1l1ll1ll11l.pack (side = l1llll (u'ࡺ࡯ࡱࠢ'), fill = l1llll (u'ࡦࡴࡺࡨࠧ'), expand = True)

Known limitations:

  • A comment after a string literal should be preceded by whitespace.

  • A ‘ or “ inside a string literal should be escaped with \ rather then doubled.

  • A # in a string literal can only be used at the start, so use ‘p’’#’’r’ rather than ‘p#r’.

  • Obfuscation of string literals is unsuitable for sensitive information since it can be trivially broken

That’s it, enjoy!

Jacques de Hooge

jacques.de.hooge@qquick.org

Other packages you might like:

Licence

Copyright 2014, 2015, 2016 Jacques de Hooge, GEATEC engineering, www.geatec.com

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Metadata

Release files for Opy 1.1.20

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Opy 1.1.20
File Size Uploaded Provenance Actions
Opy-1.1.20.zip 17.2 kB Without provenance Details for Opy-1.1.20.zip

Release files / Opy-1.1.20.zip

Download URL Opy-1.1.20.zip
Size 17.2 kB
Tags Source
SHA-256 checksum
How to use checksums
567cd4939e22f9fcbcc83fa9de80970a45e9b6b9a40d8b20274bfb9c88dd8fd6
BLAKE2b-256 checksum
How to use checksums
05263e91b9d447a71dcfc3dab63c8398a3027a262b6528171df3ef3613fa6810
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for Opy 1.1.20

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page