From 863e963dead137878ecbcffb58d11f50cb0f107d Mon Sep 17 00:00:00 2001 From: FEIJINTI <83849113+FEIJINTI@users.noreply.github.com> Date: Wed, 19 Oct 2022 10:49:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E5=8A=A0=E5=AF=86?= =?UTF-8?q?=E5=92=8Cwindos=E8=87=AA=E5=90=AF=E5=8A=A8=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E7=9A=84=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/README.md b/README.md index ea35201..9e54d05 100644 --- a/README.md +++ b/README.md @@ -46,3 +46,59 @@ ![测试结果](./pics/result.png) +## 开机自启动 + +启动文件 xxx.bat 放在路径 +```bash +C:\Users\你的用户名\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup +``` +示例如下 +```bash +@echo off +if "%1" == "h" goto begin +mshta vbscript:createobject("wscript.shell").run("""%~0"" h",0)(window.close)&&exit +:begin + +call C:\Users\FEIJINTI\miniconda3\Scripts\activate.bat C:\Users\FEIJINTI\miniconda3 +call conda activate cv +cd C:\Users\FEIJINTI\OneDrive - macrosolid\PycharmProjects\start_test +python 1.py +pause +``` +其中第一段是为了不显示cmd窗口 + +第二段根据需求修改环境名以及启动程序 + +## 代码加密 + +安装 +```bash +pip install jmpy3 + +``` + +```bash +# -*- coding: utf-8 -*- +""" +py文件加密为so或pyd +python代码 加密|加固 +参数说明: + -i | --input_file_path 待加密文件或文件夹路径,可是相对路径或绝对路径 + -o | --output_file_path 加密后的文件输出路径,默认在input_file_path下创建dist文件夹,存放加密后的文件 + -I | --ignore_files 不需要加密的文件或文件夹,逗号分隔 + -m | --except_main_file 不加密包含__main__的文件(主文件加密后无法启动), 值为0、1。 默认为1 + +报错: + AttributeError: 'str' object has no attribute 'decode' + 找到报错文件:_msvccompiler.py + 参考:https://blog.csdn.net/qq_43192819/article/details/108981008 + 128行代码修改为:.encode().decode('utf-16le', errors='replace') +""" + +from jmpy.encrypt_py import start_encrypt +# 需要加密的py文件 +input_file_path = "test.py" +# 直接运行 +start_encrypt(input_file_path=input_file_path, output_file_path=None, ignore_files=None, except_main_file=0) + +``` \ No newline at end of file