An in-place obfuscator for python 3.11
Project description
PyObf 2
A "continuation" of sorts of the old, private pyobf.
Installing
The package now has a pypi! https://pypi.org/project/pyobf2/
Install with python3 -m pip install pyobf2
Usage
The obfuscator has 2 modes of operation.
- Standalone
The obfuscator runs on its own, with it's own config system. This is the default. Run withpython3 -m pyobf2
. A configuration file,config.toml
, will be generated with the default values. Edit it, and run pyobf2 again to run the obfuscator with the config. - API
The obfuscator has an API, to allow you to integrate it into your own projects. For example, it can be used to obfuscate the output of a code generator automatically. An example of this API being used can be seen inapi_example.py
.
If you end up using the API, please credit this repository.
API usage
As previously mentioned, the api_example.py
file contains examples on how the api works. Some notes are required, though:
- When obfuscating multiple files that depend on each other, use
do_obfuscation_batch_ast
, instead of callingdo_obfuscation_single_ast
on all of them separately. This will allow the obfuscator to draw conclusions on which file depends on which other file, and allows it to understand the structure between them. do_obfuscation_batch_ast
is a generator. It will progressively yield each step it does, to allow for progress bar rendering. It will do nothing when not iterated through.- Some transformers (eg.
packInPyz
,compileFinalFiles
) only act on the output files of the obfuscation process, and do nothing in the standard run. To invoke them, usedo_post_run
. This will require you to write the obfuscated AST into a file, though.
Feedback & bugs
The obfuscator is in no way perfect as of now, so feedback is encouraged. Please tell me how bad my code is in the issues tab.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyobf2-1.0.3.tar.gz
(26.8 kB
view hashes)
Built Distribution
pyobf2-1.0.3-py3-none-any.whl
(32.5 kB
view hashes)