pyarmor 是一个高安全性的 Python 脚本加密工具,从 v6.6.0 开始,提供了将加密脚本直接转换成为扩展模块或者可执行文件的功能,从而更进一步的提高了安全性。
使用方法
确认已经安装 pyarmor
pip install pyarmor
点击这里下载 buildext.py,
查看脚本的命令行选项
python buildext.py -h
在 v6.6.0 之后,不需要下载 buildext
,可以直接使用下面的等价命令
python -m pyarmor.helper.buildext -h
生成扩展模块
-
首先加密脚本,必须使用
--no-cross-protection
和--restrict 0
选项,否则运行时候会出现约束错误pyarmor obfuscate --no-cross-protection --restrict 0 foo.py
-
转换所有在
dist
目录下面的加密脚本成为扩展模块python buildext.py dist/ ls dist/
选项 -i