File tree Expand file tree Collapse file tree 4 files changed +54
-10
lines changed
Expand file tree Collapse file tree 4 files changed +54
-10
lines changed Original file line number Diff line number Diff line change 1- # binaryPy
1+ ## binary-python 使用说明
22
3- ## 工具介绍
3+ ** 使用前,请确保电脑上已经安装docker **
44
5- 将python代码加密为so或pyd(支持项目文件/单个文件加密)
65
7- Git仓库地址: https://github.com/xqlip/binaryPy.git
6+ ### 一、基础环境镜像准备(基于ubuntu18.04、python3.6进行二进制)
87
9- python: 3.6 +
10- ## 安装
8+ ** 注:不同平台(ubuntu、windows、os)进行二进制的代码,不能跨平台使用,即ubuntu上二进制的代码,只能ubuntu上运行,其他平台使用会报错。**
119
12- pip install binaryPy
10+ ** 1、基于ubuntu18.04构建二进制环境镜像; **
1311
14- ## 使用方法
12+ /bin/bash 1_build_image.sh
13+
14+ ### 二、二进制 文件夹/文件 准备、运行
15+
16+ ** 1、将需要 二进制的文件夹或文件 拷贝到 binary_dir目录下,参考如下;**
17+
18+ binary_dir
19+ ├── app # 需要二进制的文件夹
20+ ├── server.py
21+ └── test_binary.py
22+
23+ ** 2、根据需求调整不需要加密的文件(即 -I 参数,-i、-o、-m无需调整);**
24+
25+ # 打开 3_binary_py.sh
26+ """
27+ source /opt/apps/python/bin/activate # 激活虚拟环境
28+ jmpy -i /opt/apps/binary_dir -I server.py,location_.*\.py -m 0 # 执行二进制
29+
30+ python代码 加密
31+ 参数说明:
32+ -i | --input_file_path 待加密文件或文件夹路径,可是相对路径或绝对路径
33+ -o | --output_file_path 加密后的文件输出路径,默认在input_file_path下创建dist文件夹,存放加密后的文件
34+ -I | --ignore_files 不需要加密的文件或文件夹,逗号分隔
35+ -m | --except_main_file 不加密包含__main__的文件(主文件加密后无法启动), 值为0、1。 默认为1
36+
37+ """
38+
39+ ** 3、运行容器 ;**
40+
41+ /bin/bash 2_run_image.sh # 运行后会自动进入容器
42+
43+ ** 4、运行二进制脚本**
44+
45+ /bin/bash 3_binary_py.sh
46+
47+ # 运行结果如下
48+ """
49+ binary_dir
50+ ├── app # 需要二进制的文件夹
51+ │ ├── server.py
52+ │ └── test_binary.py
53+ └── dist
54+ └── binary_dir # 二进制后的文件夹
55+ └── app
56+ ├── server.py
57+ └── test_binary.so
58+ """
1559
16- binaryPy -i "project dir/ file " [-o output dir] [-I ignore files]
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ RUN apt-get update -y && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-
1313
1414RUN mkdir -p /opt/apps/
1515WORKDIR /opt/apps/
16- COPY requirements.txt ./requirements.txt
16+ COPY ../ requirements.txt ./requirements.txt
1717RUN python3 -m venv python \
1818 && source python/bin/activate \
1919 && pip install --upgrade pip \
Original file line number Diff line number Diff line change 1+ Cython == 0.29.20
You can’t perform that action at this time.
0 commit comments