AST based Obfuscator for Python
An AST based Python obfuscator that robustly mangles names and other obfuscations of Python code
- DOES NOT SUPPORT: Annotations, evals, templated strings, imports of the form import xxx.yyy
- Very little configuration currently and instead takes a cautious approach in determining what identifiers to mangle. Globals, kwargs, class namespace identifiers, and others are not obfuscated but type of obfuscations should be use selected in the future.
- It is only tested with Python v3.5 and might not work with other AST versions
- Scoping for comprehensions are kind of hacky (and basically follows Python 2 comprehension scope leaking methodology)
pip install bobskater
bobskater provides a few mechanisms for direct use.
obfuscateString("")obfuscates a string of source code.
obfuscateFile('myfile.py')will obfuscate an entire file and overwrite the original
Both take keyword arguments for configuration:
removeDocstringswill remove docstrings by replacing them with
passstatements (to handle even cases where a function has only a docstring). Defaults to
obfuscateNameswill obfuscate all names except globally scoped variables, kwargs, builtins, and identifiers in a class namespace. Defaults to
There are no other obfuscations performed than the two mentioned above currently in
from bobskater import obfuscateString myFileContents = open('myfile.py', 'r').read() #Will obfuscate myFileContents and return it into output. Names will not be mangled, only docstrings will be removed output = obfuscateString(myFileContents, obfuscateNames=False)
pytest - Runs all the tests
Refer to the python docs on packaging for clarification.
Make sure you've updated
setup.py, and have installed
python3 setup.py sdist bdist_wheel - Create a source distribution and a binary wheel distribution into
twine upload dist/bobskater-x.x.x* - Upload all
dist/ files to PyPI of a given version
Make sure to tag the commit you released
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size bobskater-0.2.1-py3-none-any.whl (11.3 kB)||File type Wheel||Python version py3||Upload date||Hashes View|
|Filename, size bobskater-0.2.1.tar.gz (9.6 kB)||File type Source||Python version None||Upload date||Hashes View|
Hashes for bobskater-0.2.1-py3-none-any.whl