Pyarmor is a command line tool used to obfuscate python scripts, bind obfuscated scripts to fixed machine or expire obfuscated scripts.
- The obfuscated scritpt is still a normal
.py
script, in most of cases the original python scripts can be replaced with obfuscated scripts seamlessly. - Provide many ways to obfuscate the scripts to balance security and performance
- Rename functions/methods/classes/variables/arguments, irreversible obfuscation
- Convert part of Python functions to C functions, compile them to machine instructions by high optimize option, irreversible obfuscation
- Bind obfuscated scripts to fixed machine or expire obfuscted scripts
- Protect obfuscated scripts by Themida (Only for Windows)
- Python 2 and Python 31
- Windows
- Many linuxs, include embedded systems, Raspberry Pi etc.
- Apple Intel and Apple Silicon
- Support arches: x86_64, aarch64, armv7 etc.2
Install
pip install pyarmor
Obfuscate the script foo.py
pyarmor gen foo.py
This command generates an obfuscated script dist/foo.py
like this:
from pyarmor_runtime import __pyarmor__
__pyarmor__(__name__, __file__, b'\x28\x83\x20\x58....')
Run it
python dist/foo.py
Also look at the getting started
Pyarmor is published as shareware, free trial version never expires, but there are some limitations.
Pyarmor licenses introduces license type, features and limitations for each license type and how to purchase Pyarmor license.
Also read EULA of Pyarmor
Having trouble?
Read this Pyarmor 8.0 Documentation at first.
Try the FAQ – it's got answers to many common questions.
Looking for specific information? Try the documentation index, or the detailed table of contents.
Not found anything? See asking questions in github.
Report bugs according to the issue template.
Send email to [email protected] for business and security issue.
中文资源
There are significant changes in Pyarmor 8.0. Pyarmor 8.0 has been rewritten,
and new features are implemented by new commands: gen
, reg
, cfg
. And they
only works for Python 3.7+.
At first release, only x86_64 for windows, linux, macosx works (2023-03-08), and aarch64 for linux and macosx works soon (before 2023-04-01), armv7 and x86 will work about 2023-06-01. For all the other arches only on demand.
Users prior to 8.0 should read this Import Notes to make judge whether upgrade Pyarmor
Each major version has one file to log changes, it describes the fixed issues, new features, incompatible issues in different versions
It's important to read this carefully before upgrading pyarmor.
In future only bug fix for old commands, no new features for old commands.
The old commands obfuscate
, licenses
etc. still could be used, but there
have some changes.
There are 3 cases for old users after Pyarmor 8.0 is released:
-
SPP mode doesn't work
In order to use SPP mode, it's necessary to upgrade Pyarmor to 8.0+
-
Command
pyarmor register
without any argument return404
errorIt is used to query registration information in old Pyarmor, but now license server doesn't serve this web api.
Instead use
pyarmor -v
to make sure it's not trial version. -
Registering Pyarmor by
pyarmor register pyarmor-regcode-xxxxxx.txt
can be used no more than 10 timesIn order to use Pyarmor in new machine, CI server or docker, check the second method described in the registration file "pyarmor-regcode-xxxxxx.txt":
Downloading "pyarmor-regfile-xxxxxx.zip" once, use this `.zip` file to register Pyarmor later.
By default, command pyarmor
only accepts new commands, there are 3 ways to
use old commands such as obfuscate
, licenses
:
- Use
pyarmor-7
insteadpyarmor
- Export environment variable
PYARMOR_CLI=7
, then still usepyarmor
- Any way to call entry point
pyarmor.pyarmor:main_entry
-
Follow new EULA of Pyarmor. It's a big change for old personal license, because new license only allows one proudct.
-
Not all old licenses could be upgraded to new license freely, refer to Pyarmor licenses
-
The old commands need not internect connection, but new command need
-
The old commands support Python 2.7~3.10, but new command only support Python 3.7+