Skip to main content

代码混淆

Project description

Pylicenser

提供了2种加密的方式:

  1. 基于sourcedefender的原理自己加以实现的,更好的兼容了目录级别的代码加密。
  2. 使用Cython进行代码封装,也支持了目录级别的文件加密。

此外,Pylicenser还支持运行时的过期校验——即设置ttl,服务启动后,Pylicenser会在其运行过程中时检测失效时间。

安装

pip install pylicenser

1. 使用encrypt方式加密

usage: pylicenser encrypt [-h] [--ttl TTL] [--dist DIST] str [str ...]

positional arguments:
  str          待加密的文件或文件夹

optional arguments:
  -h, --help   帮助信息
  --ttl TTL    有效日期,默认:0,单位:seconds。示例: 1s、2d、3m、4h (default: 0)
  --dist DIST  输出目录,默认当前dist目录 (default: ./dist)
  --verbose   是否打印日志 (default: False)

运行加密代码

该种方式支持使用pylicenser run运行加密脚本,但是不支持原生的python -m script,如需使用该种方式请采用撰写脚本引用的方式进行。

pylicenser run

usage: pylicenser run [-h] script ...

positional arguments:
  script      py脚本文件
  args        脚本需要的参数

optional arguments:
  -h, --help  帮助信息
  --verbose   是否打印日志 (default: False)

脚本加载引用加密后pye文件

# 需要先引入,用于识别pye文件
import pylicenser
from package.module_file import func # module_file为加密后的pye文件
if __name__ == '__main__':
    print(func(1, 4, 'x'))

2. 使用Cython方式加密

采用该方式需要预先安装Cython,安装方式如下:

pip install Cython

使用方式如下:

usage: pylicenser cython [--dist DIST] [-h] str [str ...]

positional arguments:
  str          待编译的代码文件或文件夹

optional arguments:
  --dist DIST  输出目录,默认当前dist目录 (default: ./dist)
  -h, --help   帮助信息
  --verbose   是否打印日志 (default: False)

Cython加密后,不影响代码原有使用方式,即原来脚本怎么运行,加密后还是怎么运行。
相较于第一种加密,Cython加密具有平台依赖性,即在darwin上加密的代码在win或者linux下不一定能运行。

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pylicenser-0.0.14-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.5+ x86-64

pylicenser-0.0.14-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.5+ x86-64

pylicenser-0.0.14-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.5+ x86-64

pylicenser-0.0.14-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.6mmanylinux: glibc 2.5+ x86-64

File details

Details for the file pylicenser-0.0.14-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pylicenser-0.0.14-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 b406ce4e2920ee20bea56256d68974e8df79241440426ee2280bf28dac7ed035
MD5 6118735e40027b233428f5306971b071
BLAKE2b-256 173a08af1dc4339e56c85a63e9d7346192f0516817f834f9921a27997b7b30ca

See more details on using hashes here.

File details

Details for the file pylicenser-0.0.14-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pylicenser-0.0.14-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 552759b06c2f3d76e02d2cddad2503697ff53bffb208a1c9566b2f853d31dea9
MD5 fb61a9c5db1024c7bdfa03c9875b826a
BLAKE2b-256 d1a2b497494e27ac207e304de81afb3733506194d89a24c4cebd3ddd30e39ebe

See more details on using hashes here.

File details

Details for the file pylicenser-0.0.14-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pylicenser-0.0.14-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 4aea29e4b4582ed59b8226fe58b46831a741cf1d1ec343bf39468f70241fefc8
MD5 7561b5f1a7d9fa2bca1d764bb2c47518
BLAKE2b-256 af1f5b5109aa069d433e9578af5fa146454934b864dfd07e9a297451e905e2df

See more details on using hashes here.

File details

Details for the file pylicenser-0.0.14-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pylicenser-0.0.14-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 d5500e54cf7ebf0b85cdd5e0fc5cb8a6687a4e554c30b0ff9b7747b25786aa3e
MD5 3aba4eaf8e0ce423eb10951f603ee78f
BLAKE2b-256 c4aaac7e881a7154238dacd58d4ea2ff62c964982ce508f315b1a35692f9c2b9

See more details on using hashes here.

Supported by

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