Skip to main content
Join the official Python Developers Survey 2018 and win valuable prizes: Start the survey!

OPY - Obfuscator for Python, string obfuscation added, keyword added

Project description

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:

  • String obfuscation now accepts ‘n’ in string
  • All strings converted unicode if string obfuscation is on

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

What’s new:

  • Development Status bumped from “4 - Beta” to “5 - Production/Stable”

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 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

qQuickLicence

This license governs use of the accompanying software (“Software”), and your use of the Software constitutes acceptance of this license.

You may use the Software for any commercial or noncommercial purpose, including distributing derivative works.

In return, it is required that you agree:

  1. Not to remove any copyright or other notices from the Software.
  2. That if you distribute the Software in source code form you do so only under this license (i.e. you must include a complete copy of this license with your distribution in a plain text file named QQuickLicence.txt), and if you distribute the Software solely in object form you only do so under a license that complies with this license.
  3. That the Software comes “as is”, with no warranties. None whatsoever. This means no express, implied or statutory warranty, including without limitation, warranties of merchantability or fitness for a particular purpose or any warranty of title or non-infringement. Also, you must pass this disclaimer on whenever you distribute the Software or derivative works.
  4. That neither Geatec Engineering nor any contributor to the Software will be liable for any of those types of damages known as indirect, special, consequential, or incidental related to the Software or this license, to the maximum extent the law permits, no matter what legal theory it’s based on. Also, you must pass this limitation of liability on whenever you distribute the Software or derivative works.
  5. That you will not use or cause usage of the Software in safety-critical situations under any circumstances.
  6. That if you sue anyone over patents that you think may apply to the Software for a person’s use of the Software, your license to the Software ends automatically.
  7. That your rights under this License end automatically if you breach it in any way.
  8. That all rights not expressly granted to you in this license are reserved.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
Opy-1.1.13.zip (16.5 kB) Copy SHA256 hash SHA256 Source None Nov 13, 2015

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page