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

A python package could import/run encrypted python scripts.

Project Description

Pyarmor, Guard your python scripts
==================================

Do you worry about how to protect your python scripts? Now, it's easy
with the coming of Pyarmor.

What's Pyarmor
--------------

A python package could import/run encrypted python scripts.

Who Use Pyarmor
---------------

A python developer wants to release his project, but do not want to
publish the literal scripts. What should he do?

* Use pyarmor to encrypt the python scripts
* Distribute encrypted python scripts to the customer

That's all.

Supported Python Versions
-------------------------

Pyarmor need python 2.6 or later, but it supports to run/import the
encrypted scripts from Python 2.3 to the latest Python by Cross
Publish (See below).

Supported platforms
-------------------

Windows, Linux, including Embeded Linux are supported, The following
operation systems have been tested:

* Windows XP, Windows7 both x86 and amd64
* Ubuntu 13.04 both i686, x86_64 and armv7

Conception
==========

Project Capsule
---------------

A zip file includes all the auxiliary files which used to import the
encrypted scripts. It's generated by Pyarmor.


Installation
============

* Install corresponding Python

* Run pip to install pyarmor package from pypi.python.org

$ pip install pyarmor

Or

* Download the package from pypi.python.org or

http://dashingsoft.com/products/pyarmor/pyarmor-1.7.2.zip

http://dashingsoft.com/products/pyarmor/pyarmor-1.7.2.tar.bz2

http://dashingsoft.com/products/pyarmor/pyarmor-1.7.2.tar.gz

* Extract the downloaded package to any path, for example,
c:/pyarmor or /opt/pyarmor

Basic Usage
===========

The normal scenario for a developer to use pyarmor is

* Generate project capsule for each project
* Encrypt python scripts with project capsule

Then

* Distribute the encrypted scripts to target machine

Let me show you how to use pyarmor to encrypt scripts and how to
distribute encrypted scripts.


Developer Side
--------------

Assume you have 2 scripts: moda.py modb.py,

* Generate project capsule

`For example,`::

$ python pyarmor.py capsule

It will make a file "project.zip" in the current directory.

* Encrypt python scripts

`For example,`::

$ python pyarmor.py encrypt --with-capsule=project.zip \
moda.py modb.py

After above command finished, you will find the following files in
the path "dist"

* moda.pyx
* modb.pyx

* pyimcore.py
* pytransform.pyd (for windows) or pytransform.so (for linux)
* cygtfm-0.dll / libtfm-0.dll (only for windows)
* cygtomcrypt-0.dll / libtomcrypt-0.dll (only for windows)
* pyshield.key
* pyshield.lic
* product.key
* license.lic

The first 2 files are encrypted scripts, the others are
auxiliary. All of these files is required when distribute encrypted
scripts.

`About more usage of pyarmor`::

C:/Python32/python pyarmor --help

C:/Python32/python pyarmor encrypt --help

Customer Side
-------------

Before you distribute encrypted scripts above, you need change a
little in your main script -- add a line 'import pyimcore' before
import those encrypted module. Assume your startup script is main.py,
what you will do is add a line in the file header somewhere.

`For example,`::

import pyimore

The main function of pyimcore is to install an import hook, so that
the encrypted module will be imported correctly. For you, everything
is transparent, all of the source code need to be changed nothing
else !

Now copy the following files to your customer:

* main.py
* moda.pyx
* modb.pyx

* pyimcore.py
* pytransform.pyd (for windows) or pytransform.so (for linux)
* cygtfm-0.dll / libtfm-0.dll (only for windows)
* cygtomcrypt-0.dll / libtomcrypt-0.dll (only for windows)
* pyshield.key
* pyshield.lic
* product.key
* license.lic

And run it as if there are no any encrypted scripts.

Advanced Usage
==============

Run Encrypted Script
--------------------

Someone maybe say I want to encrypt my startup script either, then how
to run it.

`Encrypt the script at first,`::

$ python pyarmor.py encrypt --with-capsule=project.zip \
main.py moda.py modb.py

`Run python with -c, for example,`::

python -c "import pyimcore
import pytransform
pytransform.exec_file('main.pyx')"

`Or create a startup script startup.py like this,`::

import pyimcore
import pytransform
pytransform.exec_file('main.pyx')

Then run startup.py as normal python script.

You can read the source file pyarmor.py to know the basic usage of
pytransform extension.

Cross Publish
-------------

If target machine is different from development machine, you need use
option '--with-extension' to publish encrypted scripts. A common case
is to distribute python scripts to embedded linux system. The only
difference is to replace python extension "pytransform" with the
corresponding platform.

* In the sub-directory "extensions" of pyarmor, there are many files
looks like:

pytransform-1.7.2.win32-ARCH-pyX.Y.pyd

pytransform-1.7.2.linux-ARCH-pyX.Y.so

X.Y is python major and minor version, ARCH may be x86, x86_64, arm etc.

`Encrypt scripts with option --with-extension`::

$ python pyarmor.py encrypt --with-capsule=project.zip \
--with-extension=extensions/pytransform-1.7.2.linux-arm-py2.so \
main.py moda.py modb.py

`Another example, encrypted scripts for Python2.3`::

$ python3 pyarmor.py encrypt --with-capsule=project.zip \
--with-extension=extensions/pytransform-1.7.2.win32-x86-py2.3.pyd \
main.py moda.py modb.py


Change Logs
===========

1.7.3
-----

* Add information for using registration code

1.7.2
-----

* Add option --with-extension to support cross-platform publish.

* Implement command "capsule" and add option --with-capsule so that
we can encrypt scripts with same capsule.

* Remove command "convert" and option "-K/--key"

1.7.1
-----

* Encrypt pyshield.lic when distributing source code.

1.7.0
-----

* Enhance encrypt algorithm to protect source code.
* Developer can use custom key/iv to encrypt source code
* Compiled scripts (.pyc, .pyo) could be encrypted by pyshield
* Extension modules (.dll, .so, .pyd) could be encrypted by pyshield

Known Issues
============

[Need to document]

Bug reports
===========

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

More Information
================

The trial license will be expired in the end of this quarter, after
that, you need pay for registration code from

http://dashingsoft.com/products/pyarmor.html

You will receive information electronically immediately after
ordering, then replace the content of "license.lic" with registration
code only (no newline).

All of these functions are integrated to an IDE tool named as Pyshield
either, see

http://www.dashingsoft.com/products/pyshield.html

for more.

Copyright (c) 2009 - 2014 Dashingsoft Corp. All rights reserved.

2014-11-02 23:03 + China Standard Time

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

This version
History Node

1.7.3

History Node

1.7.2

History Node

1.7.1

History Node

1.7.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
pyarmor-1.7.3.tar.bz2 (2.6 MB) Copy SHA256 hash SHA256 Source None Nov 3, 2014
pyarmor-1.7.3.tar.gz (3.5 MB) Copy SHA256 hash SHA256 Source None Nov 3, 2014
pyarmor-1.7.3.zip (3.5 MB) Copy SHA256 hash SHA256 Source None Nov 3, 2014

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