jiyutool 0.1.0__py3-none-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
jiyutool/__init__.py ADDED
@@ -0,0 +1,61 @@
1
+ """jiyutool:用 -y -no-window 静默启动 JiYuGuard 保护。
2
+
3
+ 包内自带 JiYu-Tool.exe(主程序 + 伪 taskkill + 伪 sc),安装后直接调用 start()
4
+ 即可在后台启动保护,不弹任何提示、不显示设置界面。
5
+
6
+ >>> import jiyutool
7
+ >>> jiyutool.start()
8
+ <Popen: return code: None args: ['...\\JiYu-Tool.exe', '-y', '-no-window']>
9
+
10
+ 退出保护需要在托盘菜单(Ctrl+Alt+P 唤出)里输入解除口令,无法从 Python 侧关闭。
11
+
12
+ 注意:程序启动时自身会请求管理员权限,因此会看到一次系统的 UAC 确认框。
13
+ """
14
+
15
+ from __future__ import annotations
16
+
17
+ import os
18
+ import subprocess
19
+ from pathlib import Path
20
+
21
+ __all__ = ["start"]
22
+
23
+ _EXE_NAME = "JiYu-Tool.exe"
24
+
25
+
26
+ def _exe_path() -> Path:
27
+ """返回包内自带的 JiYu-Tool.exe 路径。"""
28
+ path = Path(__file__).resolve().parent / "data" / _EXE_NAME
29
+ if not path.is_file():
30
+ raise FileNotFoundError(f"安装不完整,缺少 {path}")
31
+ return path
32
+
33
+
34
+ def start(*, wait: bool = False) -> "subprocess.Popen[bytes] | int":
35
+ """用 -y -no-window 启动保护。
36
+
37
+ 参数:
38
+ wait 为 True 时等待启动器退出并返回退出码;默认 False,立即返回
39
+ Popen 对象(启动器拉起主程序后很快就会自行退出,保护在后台
40
+ 独立运行,不受本 Python 进程存活影响)。
41
+
42
+ 返回:
43
+ wait=False 返回 subprocess.Popen,wait=True 返回启动器退出码
44
+ (0 表示已成功移交给主程序)。
45
+
46
+ 异常:
47
+ OSError 非 Windows 平台调用。
48
+ """
49
+ if os.name != "nt":
50
+ raise OSError("jiyutool 仅支持 Windows")
51
+
52
+ exe = _exe_path()
53
+ creationflags = getattr(subprocess, "DETACHED_PROCESS", 0)
54
+ creationflags |= getattr(subprocess, "CREATE_NEW_PROCESS_GROUP", 0)
55
+
56
+ proc = subprocess.Popen(
57
+ [str(exe), "-y", "-no-window"],
58
+ close_fds=True,
59
+ creationflags=creationflags,
60
+ )
61
+ return proc.wait() if wait else proc
Binary file
@@ -0,0 +1,10 @@
1
+ Metadata-Version: 2.4
2
+ Name: jiyutool
3
+ Version: 0.1.0
4
+ Summary: 用 -y -no-window 静默启动 JiYuGuard 保护(仅 Windows)
5
+ License: Proprietary
6
+ Classifier: Operating System :: Microsoft :: Windows
7
+ Classifier: Environment :: Win32 (MS Windows)
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Topic :: System :: Systems Administration
10
+ Requires-Python: >=3.9
@@ -0,0 +1,6 @@
1
+ jiyutool/__init__.py,sha256=KgjhFQ6ulBZzOoM5bKyYlHlyFWymkQndzAbz9C4NADw,2012
2
+ jiyutool/data/JiYu-Tool.exe,sha256=vuBA4_DF_tso-UTEL8TNt12E5a8CeU7rtaVikksjsAc,1096192
3
+ jiyutool-0.1.0.dist-info/METADATA,sha256=Lcj8xuQsepE4O7QYM39Ri6aMWE326wbAfxivvCuaW0g,381
4
+ jiyutool-0.1.0.dist-info/WHEEL,sha256=bhMFZwp6VMtrbl2Ck6PlXryKaCggO1NzYn_HcFbBF1I,97
5
+ jiyutool-0.1.0.dist-info/top_level.txt,sha256=arhiS6rYtHWiIgTde7oKWRhIG5z3J6D2WJ9s7iPSq38,9
6
+ jiyutool-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-win_amd64
5
+
@@ -0,0 +1 @@
1
+ jiyutool