Skip to main content

Obfuscating code by changing the variable names to underscores

Project description

Underscore [![Build Status](](
Obfuscating code by changing the variable names to underscores

## Example

###### Input

from operator import add

class Fibber(object):

def fib(n):
a, b = 0, 1
for i in xrange(n):
a, b = b, add(a, b)
return b

print Fibber().fib(10)

###### Output

(___________, ____________, _____________) = (0, 1, 10)
(________, _________, __________) = (object, xrange, staticmethod)
from operator import add as _

class __(________):

def ___(____):
(_____, ______) = (___________, ____________)
for _______ in _________(____):
(_____, ______) = (______, _(_____, ______))
return ______
(fib,) = (___,)
print __().fib(_____________)
(Fibber, add) = (__, _)

## Installation
pip install underscore

## Usage
$ _ >
You can also compile through python
from underscore import _

_(filename, output_filename)

## Tests
There are three flavors of tests all driven by the `nosetests` framework, to add a test simply add a python file into the `examples` folder. When running the test command, `nosetests` each test will run for each file in the `examples` folder.

* `tests/`
* This test makes sure that the output of the original file matches the output of the compiled file when ran.
* `tests/`
* This test makes sure that there are not any empty files in the example folder.
* `tests/`
* This test makes sure that we are only using keywords and not using non `underscore` variables where possible
* `tests/` (Not ready yet)
* This test will turn the source code into underscored code, then with the underscored code we will turn the source code into underscored code again.. and check that the `source` and `output` are the same.. I know mind blowing..

## Roadmap
This project was started on Aug 28th, 2012. And is still under development. There is lots of things to do.. here is a `TODO` list for myself
* ~~Refactor~~
* ~~Handle attributes~~.
* ~~Handle with statements~~
* ~~Handle exception statements~~
* ~~Handle decorators~~
* ~~Handle class methods~~
* ~~Handle the case where input has underscored variables~~
* Give out warnings if users are using `exec` as this may lead to incorrect behavior.
* Turn the source into obfuscate code, and make sure it executes the same behavior.

Project details

Release history Release notifications

History Node


History Node


This version
History Node


History Node


History Node


History Node


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
Underscore-0.0.4.macosx-10.8-intel.tar.gz (20.6 kB) Copy SHA256 hash SHA256 Dumb Binary any Sep 2, 2012

Supported by

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