Skip to main content
Help us improve Python packaging – donate today!

Pyarmor, guard your python scripts

Project Description

Pyarmor is a command line tool used to guard your python scripts.

Main Functions

There are 2 features:

  • Protect python plain script by importing encrypted python scripts in
  • runtime Convert python script to executable file

The former is implemented by python extension pyshield, the latter in module pyload function.

Usage

Download package as your python version list below, extract all files to any path.

http://dashingsoft.com/products/pyshield/windows/pyarmor-1.7.0-for-windows-python-2.3.zip#md5=13ec17ac5fccfa8bf7ade8d3605dfe15 http://dashingsoft.com/products/pyshield/windows/pyarmor-1.7.0-for-windows-python-2.4.zip#md5=73be9139ea54b9162a1aca471da4b895 http://dashingsoft.com/products/pyshield/windows/pyarmor-1.7.0-for-windows-python-2.5.zip#md5=75d134c0822d5c6e8a6d0c80099f47fb http://dashingsoft.com/products/pyshield/windows/pyarmor-1.7.0-for-windows-python-2.6.zip#md5=6f69175f0670ff49c3866aae753e7f51 http://dashingsoft.com/products/pyshield/windows/pyarmor-1.7.0-for-windows-python-2.7.zip#md5=a8f48e63932518eeb580bfbb89785327 http://dashingsoft.com/products/pyshield/windows/pyarmor-1.7.0-for-windows-python-3.0.zip#md5=4d54413dab6cab9a37e2d74e4004ae27 http://dashingsoft.com/products/pyshield/windows/pyarmor-1.7.0-for-windows-python-3.1.zip#md5=9df1b06490eb862bc612a388758b14fd http://dashingsoft.com/products/pyshield/windows/pyarmor-1.7.0-for-windows-python-3.2.zip#md5=756f829cf95bfa05e1b2fca081e66ed6 http://dashingsoft.com/products/pyshield/windows/pyarmor-1.7.0-for-windows-python-3.3.zip#md5=bb5fd437f0dface002bf549d2ab3c624

Download trial license and put into the same path

http://dashingsoft.com/products/pyshield/license.tri

The main script is pyarmor.py

Encrypt Script

Command:

python pyarmor.py encrypt [OPTIONS] [File Patterns]

To encrpty the files list in the command line, you can use a specified pattern according to the rules used by the Unix shell. No tilde expansion is done, but *, ?, and character ranges expressed with [] will be correctly matched.

All the files will be encrypted and saved as original file name plus x

Available options:

-O, --output=DIR              All the encrypted files will
                              be saved here. If it's empty,
                              the encrypted file will be saved
                              in the original path.

-K, --key=HEXDATA/FILENAME    Used to encrypt scripts.
                              It could be 32-bytes hex-data string,
                              or a file which includes 32-bytes
                              hex-data string.

For example:

pyarmor encrypt -K mytest.key a.py b.py

This command will encrypt a.py and b.py by the key in the file mytest.key, and save as a.pyx, b.pyx.

Another example:

pyarmor encrypt -K mytest.key *.py src/*.py lib/*.pyc

This example showes how to use pattern to specify files.

Another example:

pyarmor encrypt -K "00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F" \
                "10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F" \
                a.py

This example uses hex-data as encrypted key.

Another example:

pyarmor encrypt -K mytest.key --output=dist/ *.py src/*.py lib/*.pyc

In this example encrypted files will be saved in the directory ‘dist’ other than the same path with the original script.

Convert Script To Executable File

Command:

python pyarmor.py convert [Options] [Scripts]

Convert script to binary file, and copy all the required file to outupt directory.

Available options:

-K, --key=HEXDATA/FILENAME  The key used to encrypt scripts.
                            It could be 32-bytes hex-data string,
                            or a file which includes 32-bytes
                            hex-data string.

-O, --output=DIR            Default is dist/

--env=NAME:VALUE            The environments used to run the script. you
                            This option can be used for many times.
                            (Not Implemented)

-p, --pypath=PATH           The extra python path used to run the script.
                            This option can be used for many times.

--exclude=PATTERN           Exclude files, given as a shell-style PATTERN

-n, --dry-run               Do not realy copy python library files, only show
                            what will do. It will spend a lot of time to copy
                            python library files because there are so many files.
                            So you can disable this action if you don't want
                            to copy python library files.

                            Note: even in dry-run mode, binary file will be
                            generated.

For example:

python pyarmor convert -K mytest.key main.py

This command will convert main.py to an execute file main.exe, copy all the required file to dist/ .

Another example:

python pyarmor convert -K mytest.key -O dist \
        --env=PYTHONUNBUFFERD:1 --env=LD_LIBRARY_PATH:/home/jondy \
        --pypath=C:\Python26\mylib --pypath=D:\Tcl\python\libs \
        --exclude=*.pyc --exclude=site-packages --exclude=test \
        main.py hello1.py

This command will convert main.py, hello.py to main.exe, hello.exe, and don’t copy compiled library files (*.pyc), don’t copy site-packages, don’t copy all the test module.

Note: The output path MUST NOT be in the sub-directory of any pyth path.

Known Issues

[Need to document]

Bug Reports

Send an email to jondy.zhao@gmail.com, Thanks.

More Information

Read file pyshield.rst pyload.rst in the package.

Release history Release notifications

History Node

3.9.0

History Node

3.8.10

History Node

3.8.9

History Node

3.8.8

History Node

3.8.7

History Node

3.8.6

History Node

3.8.5

History Node

3.8.4

History Node

3.8.3

History Node

3.8.2

History Node

3.8.1

History Node

3.8.0

History Node

3.7.5

History Node

3.7.4

History Node

3.7.3

History Node

3.7.2

History Node

3.7.1

History Node

3.7.0

History Node

3.6.2

History Node

3.6.1

History Node

3.6.0

History Node

3.5.1

History Node

3.5.0

History Node

3.4.3

History Node

3.4.2

History Node

3.4.1

History Node

3.4.0

History Node

3.3.1

History Node

3.3.0

History Node

3.2.1

History Node

3.2.0

History Node

3.1.7

History Node

3.1.6

History Node

3.1.5

History Node

3.1.4

History Node

3.1.3

History Node

3.1.2

History Node

3.1.1

History Node

3.0.1

History Node

2.6.1

History Node

2.5.5

History Node

2.5.3

History Node

2.5.2

History Node

2.5.1

History Node

2.4.1

History Node

2.3.4

History Node

2.3.3

History Node

2.3.2

History Node

2.3.1

History Node

2.2.1

History Node

2.1.2

History Node

2.1.1

History Node

2.0.1

History Node

1.7.7

History Node

1.7.6

History Node

1.7.5

History Node

1.7.4

History Node

1.7.3

History Node

1.7.2

History Node

1.7.1

This version
History Node

1.7.0

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page