Important
Here only includes Pyarmor 9.1 new features, other functions please check Pyarmor 9.0 Documentation
2. Concepts
2.1. Terms
- Project
Project is used to manage scripts and options
- MINI Script
Python script, generated by pyarmor
It need import Python extension pyarmor_mini to run
- RFT Script
Python script, generated by pyarmor, only functions, classes, attributes etc. in the scripts are renamed
It need not any other extension to run
- VMC Script
Python script, generated by pyarmor, all or part of statements in the function body are replaced by Pyarmor VM code.
It need Python extension pyarmor_mini in the runtime
- ECC Script
Python script, generated by pyarmor, , all or part of statements in the function body are replaced by real machine code.
It need C compiler in build time and the obfuscation is irreversible.
It need Python extension pyarmor_mini in the runtime.
- pyarmor
One cli application to generate obfuscated scripts
- pyarmor_mini
Python extension, published in PyPI package pyarmor.mini
- pyarmor.cli
Python package, published in PyPI
- pyarmor.mini
Python package, published in PyPI, provide extension pyarmor_mini
2.2. Project
2.3. MINI Script
This is plain script foo.py
import sys
data = 'abcxyz'
def hello(msg):
print('hello world')
print(msg)
def sum2(a, b):
return a + b
def main(msg):
a = 2
b = 6
hello(msg)
print('%s + %s = %d' % (a, b, sum2(a, b)))
if __name__ == '__main__':
main('pass: %s' % data)
This is MINI script of foo.py
# Pyarmor MINI 1, requires: pyarmor_mini >= 1.0
from pyarmor.mini.pyarmor_mini import __pyarmor__
__pyarmor__(__name__, b'xxxx')
2.4. RFT Script
This is RFT script of foo.py
import sys as pyarmor__35
pyarmor__325 = 'abcxyz'
def pyarmor__4146(pyarmor__12):
print('hello world')
print(pyarmor__12)
def pyarmor__51637(pyarmor__214, pyarmor__488):
return pyarmor__214 + pyarmor__488
def pyarmor__2063(pyarmor__12):
pyarmor__214 = 2
pyarmor__488 = 6
pyarmor__4146(pyarmor__12)
print('%s + %s = %d' % (pyarmor__214, pyarmor__488, pyarmor__51637(pyarmor__214, pyarmor__488)))
if __name__ == '__main__':
pyarmor__2063('pass: %s' % pyarmor__325)
2.5. ECC Script
This is final ECC Script of foo.py
# Pyarmor ECC 1, requires: pyarmor_mini >= 3.0
from pyarmor.mini.pyarmor_mini import __pyarmor__
__pyarmor__(__name__, b'xxxx', 3)
This ECC Script has the following equivalent form (all the C code are hidden)
_pyarmor_ecc_var = ()[0](('data', 'abcxyz', '__name__', '__main__', 'main', 'pass: %s'))
import sys
()[1](_pyarmor_ecc_var)
def hello(msg):
_pyarmor_ecc_var = ()[0](('print', 'hello world'))
()[2](_pyarmor_ecc_var)
def sum2(a, b):
_pyarmor_ecc_var = ()[0](None)
return ()[3](_pyarmor_ecc_var)
def main(msg):
_pyarmor_ecc_var = ()[0]((2, 6, 'hello', 'print', '%s + %s = %d', 'sum2'))
if not _pyarmor_ecc_var:
b, a = []
()[4](_pyarmor_ecc_var)
()[5](_pyarmor_ecc_var)
2.6. VMC Script
This is final VMC Script of foo.py
# Pyarmor VMC 1, requires: pyarmor_mini >= 3.0
from pyarmor.mini.pyarmor_mini import __pyarmor__
__pyarmor__(__name__, b'xxxx', 2)
This VMC Script has the following equivalent form
_pyarmor_vmc_var = ()[1](('data', 'abcxyz', '__name__', '__main__', 'main', 'pass: %s'))
import sys
()[2]((_pyarmor_vmc_var, '__pyarmor_vmc_code_block_1__'))
def hello(msg):
_pyarmor_vmc_var = ()[1](('print', 'hello world'))
()[2]((_pyarmor_vmc_var, '__pyarmor_vmc_code_block_2__'))
def sum2(a, b):
_pyarmor_vmc_var = ()[1](None)
return ()[2]((_pyarmor_vmc_var, '__pyarmor_vmc_code_block_3__'))
def main(msg):
_pyarmor_vmc_var = ()[1]((2, 6, 'hello', 'print', '%s + %s = %d', 'sum2'))
if not _pyarmor_vmc_var:
b, a = []
()[2]((_pyarmor_vmc_var, '__pyarmor_vmc_code_block_4__'))
()[2]((_pyarmor_vmc_var, '__pyarmor_vmc_code_block_5__'))
2.7. pyarmor commands
Sub Commands
Command Relations