Overview of Pyarmor CLI Core
masterpyarmor.cli.core package provides the necessary prebuilt extension modules, pytransform3 and pyarmor_runtime, required for Pyarmor to function.repository·master·Indexed 26 days ago
https://github.com/dashingsoft/pyarmorA command-line tool for obfuscating Python scripts to provide security through code renaming, C function conversion, and machine or expiration binding. Features include license security via plugins (Pyarmor 7), Super Mode for improved security (v6.2.0+), cross-platform obfuscation, and support for shared runtimes and unique suffixes to prevent library conflicts.
pyarmor.cli.core package provides the necessary prebuilt extension modules, pytransform3 and pyarmor_runtime, required for Pyarmor to function.PyArmor is a command-line tool designed to obfuscate Python scripts. It provides several layers of protection for Python code, including:
co_code of each function (code object) during execution.f_locals of frames immediately after a code object completes execution.PyArmor supports Python 2.6, 2.7, and Python 3.
PyArmor is a command-line tool used to obfuscate Python scripts, bind them to specific machines, or set expiration dates. It protects code through several mechanisms:
co_code of each function (code object) at runtime.f_locals of a frame immediately after a code object completes execution.Pyarmor documentation is organized into five main parts to assist users at different stages of expertise:
getting-started guide.Pyarmor is a command line tool used to obfuscate Python scripts. It allows you to balance security and performance through various methods, including:
.py files that can replace originals.PyArmor provides security through a two-level obfuscation process:
At runtime, only the currently called function is restored. As soon as the code object completes execution, it is re-obfuscated. This prevents attackers from using a C debugger to trace and capture the entire code structure at once, as only a small piece of the code object is available in plain text at any given time.
The PyArmor trial version is 'Free To Use But Restricted'. Key limitations include:
PyArmor is a command line tool used to obfuscate Python scripts, bind obfuscated scripts to fixed machines, or expire obfuscated scripts.
From v5.7.1, most commands support aliases using their first character (e.g., pyarmor o is equivalent to pyarmor obfuscate).
Core Commands:
obfuscate: Obfuscate Python scripts.licenses: Generate new licenses for obfuscated scripts.pack: Obfuscate scripts then pack them into a single bundle.hdinfo: Show hardware information.Project Management Commands:
init: Create a project to manage obfuscated scripts.config: Update project settings.build: Obfuscate all scripts in the project.info: Show project information.check: Check project consistency.Other Commands:
benchmark: Run benchmark tests on the current machine.register: Make registration files work.download: Download platform-dependent dynamic libraries.runtime: Generate runtime packages separately.pyarmor <command> [options]Pyarmor protects Python source code by transforming it into a specialized encrypted format. Instead of relying on standard Python import mechanisms which leave bytecode vulnerable to decompilation, Pyarmor:
try...finally block.__armor_enter__ at the start and __armor_exit__ at the end of code blocks.__pyarmor__ to restore and execute the code in memory.This approach provides security comparable to protecting C binaries by operating at the bytecode level and implementing anti-debugging/anti-tamper checks within the __armor_enter__ routine.
Pyarmor uses irreversible obfuscation to protect Python scripts. However, there is a direct trade-off between security levels and execution performance. Higher security settings generally increase the overhead of the obfuscated script.
Security Limitations:
pyarmor_runtime binary extension is difficult to trace via a debugger, a debugger might still be used to bypass runtime key verification.When you obfuscate a script (e.g., foo.py) using PyArmor, the output in the dist directory contains the obfuscated script and several 'Runtime Files' required for execution. The original script can be replaced by the obfuscated version seamlessly as long as the runtime files are in the Python path.
Typical output files in dist/:
foo.py: The obfuscated script.pytransform.py: Python runtime module._pytransform.so (Linux), _pytransform.dll (Windows), or _pytransform.dylib (macOS): The dynamic library.pytransform.key: Runtime key.license.lic: The license file used for verification.To install the web interface for PyArmor, use the following command:
pip install pyarmor-webui