Skip to main content

Pyarmor, guard your python scripts

Project description

.. include glogals.rst

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.1-for-windows-python-2.3.zip#md5=89bbffa162847a4a877db7d180544622
http://dashingsoft.com/products/pyshield/windows/pyarmor-1.7.1-for-windows-python-2.4.zip#md5=0ec8c1f2902f9b20f1aed2e7c51e6de5
http://dashingsoft.com/products/pyshield/windows/pyarmor-1.7.1-for-windows-python-2.5.zip#md5=1aebd3d59fc429b4f76e5929c4f136c7
http://dashingsoft.com/products/pyshield/windows/pyarmor-1.7.1-for-windows-python-2.6.zip#md5=58a733534d2c176444401e1c2d0f212a
http://dashingsoft.com/products/pyshield/windows/pyarmor-1.7.1-for-windows-python-2.7.zip#md5=c8fccd6ff57b6ec9972c7642a2ba87c4
http://dashingsoft.com/products/pyshield/windows/pyarmor-1.7.1-for-windows-python-3.0.zip#md5=2bc23ae35c616bf5ab52a2848986d424
http://dashingsoft.com/products/pyshield/windows/pyarmor-1.7.1-for-windows-python-3.1.zip#md5=eeb910d62f99a9ed19fc8a7ec5b98959
http://dashingsoft.com/products/pyshield/windows/pyarmor-1.7.1-for-windows-python-3.2.zip#md5=276d9ae7b5f14f6b876c3ac19dbb1f01
http://dashingsoft.com/products/pyshield/windows/pyarmor-1.7.1-for-windows-python-3.3.zip#md5=0ef4f163131c6856a177d2d19dea21a2

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.

Project details


Release history Release notifications | RSS feed

This version

1.7.1

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page