Python obfuscator online
(as a web form)

This web form obfuscates your one-file Python program or module within seconds.

It achieves NON-1:1 mapping of identifiers within your program to obfuscated identifiers. For example, not only is 'self' no longer 'self', but 'self' is generally replaced by a variety of different gibberish identifiers, without impairing program functionality.

Docstrings and comments are also removed.

As a limited demo, this webpage only supports:

In general there is the additional limitation:

Please paste your source code into the box below.

12345678901234567890123456789012345678901234567890123456789012345678901234567890
         1         2         3         4         5         6         7         8

Names to specially spare from obfuscation (obfuscator should not need help for most names):


I would appreciate your feedback about this online obfuscator. Perhaps you would even like to license a more complete version of my obfuscator toolkit?

Click here for contact information.

Please report any bugs!


Technical Commentary

Limits on handling of keyword arguments

If you make a function call with keyword arguments, the keyword argument names in the function call are presently left unobfuscated. Why did I do this? Suppose the keyword arguments are going into a dictionary, as in this example code from Guido van Rossum's Python Tutorial (Release 2.4.2) wherein the dictionary is named "keywords" ...

  def cheeseshop(kind, *arguments, **keywords):
    print "-- Do you have any", kind, '?'
    print "-- I'm sorry, we're all out of", kind
    for arg in arguments: print arg
    print '-'*40
    keys = keywords.keys()
    keys.sort()
    for kw in keys: print kw, ':', keywords[kw]
  cheeseshop('Limburger', "It's very runny, sir.",
             "It's really very, VERY runny, sir.",
             client='John Cleese',
             shopkeeper='Michael Palin',
             sketch='Cheese Shop Sketch')  
which is intended to print:
  -- Do you have any Limburger ?
  -- I'm sorry, we're all out of Limburger
  It's very runny, sir.
  It's really very, VERY runny, sir.
  ----------------------------------------
  client : John Cleese
  shopkeeper : Michael Palin
  sketch : Cheese Shop Sketch  
The latter part of the output would be totally ruined if we obfuscate the keyword argument names, which would change the words 'client', 'shopkeeper' and 'sketch'. I didn't want to try to automatically distinguish every case where the keyword arguments' names should be obfuscated from every case where they should not be.

This shortcoming can become a nuisance, because if you're calling a function with many declared arguments, you might want your call to mention some declared arguments by name to improve your code's readability, and/or to help you select which of the function's default arguments you want used.

Please contact me if you find this issue important and want me to address it.


© Copyright 2002-2007 by Chris Niswander. All Rights Reserved.
unimportant tiny image