xtn-tools-pro 1.0.1.3.1__tar.gz → 1.0.1.3.3__tar.gz
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.
- {xtn-tools-pro-1.0.1.3.1/xtn_tools_pro.egg-info → xtn-tools-pro-1.0.1.3.3}/PKG-INFO +1 -1
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/setup.py +1 -1
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/utils/crypto_pro.py +26 -20
- xtn-tools-pro-1.0.1.3.3/xtn_tools_pro/utils/win.py +82 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3/xtn_tools_pro.egg-info}/PKG-INFO +1 -1
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro.egg-info/SOURCES.txt +2 -1
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/LICENSE +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/MANIFEST.in +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/README.md +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/setup.cfg +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/__init__.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/db/MongoDB.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/db/MysqlDB.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/db/RedisDB.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/db/__init__.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/__init__.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/cli.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/.gitignore +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/Dockerfile +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/README.md +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/__init__.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/app/__init__.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/app/api/__init__.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/app/api/v1/__init__.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/app/api/v1/demo.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/app/app.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/app/config/__init__.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/app/config/secure.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/app/config/setting.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/app/libs/__init__.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/app/libs/base.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/app/libs/error.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/app/libs/error_code.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/app/libs/redprint.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/app/libs/token_auth.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/app/models/__init__.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/app/models/base.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/app/models/redis_demo.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/app/validators/__init__.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/app/validators/base.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/app/validators/demo.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/docker-compose.yml +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/logs/__init__.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/obj/__init__.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/requirements.txt +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/server_run.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/test/__init__.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/uwsgi.ini +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/proxy/XiaoXiangProxy.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/proxy/__init__.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/proxy/proxy.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/task_pro/__init__.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/task_pro/go_fun_air_v1.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/task_pro/go_fun_v3.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/tools.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/utils/__init__.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/utils/audio_video.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/utils/crypto.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/utils/file_utils.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/utils/helpers.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/utils/log.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/utils/retry.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/utils/set_data.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/utils/shell.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/utils/sql.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/utils/time_utils.py +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro.egg-info/dependency_links.txt +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro.egg-info/entry_points.txt +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro.egg-info/requires.txt +0 -0
- {xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro.egg-info/top_level.txt +0 -0
@@ -25,7 +25,7 @@ class XtnDeEnAir:
|
|
25
25
|
BLOCK_SIZE = AES.block_size
|
26
26
|
|
27
27
|
@staticmethod
|
28
|
-
def
|
28
|
+
def encrypt_dict(key: bytes, raw: dict) -> str:
|
29
29
|
"""
|
30
30
|
加密
|
31
31
|
"""
|
@@ -38,15 +38,19 @@ class XtnDeEnAir:
|
|
38
38
|
return result
|
39
39
|
|
40
40
|
@staticmethod
|
41
|
-
def
|
41
|
+
def decrypt_dict(key: bytes, raw: str) -> dict:
|
42
42
|
"""
|
43
43
|
解密
|
44
44
|
"""
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
45
|
+
try:
|
46
|
+
cipher = AES.new(key, AES.MODE_ECB)
|
47
|
+
enc = base64.b64decode(raw)
|
48
|
+
decrypted = cipher.decrypt(enc)
|
49
|
+
result = unpad(decrypted, XtnDeEnAir.BLOCK_SIZE).decode('utf-8')
|
50
|
+
return json.loads(result)
|
51
|
+
except (ValueError, KeyError, json.JSONDecodeError) as e:
|
52
|
+
# raise ValueError(f"解密失败: {e}")
|
53
|
+
return {}
|
50
54
|
|
51
55
|
|
52
56
|
class XtnDeEnPro:
|
@@ -83,7 +87,8 @@ class XtnDeEnPro:
|
|
83
87
|
result = decrypted.decode('utf-8')
|
84
88
|
return json.loads(result)
|
85
89
|
except (ValueError, KeyError, json.JSONDecodeError) as e:
|
86
|
-
raise ValueError(f"解密失败: {e}")
|
90
|
+
# raise ValueError(f"解密失败: {e}")
|
91
|
+
return {}
|
87
92
|
|
88
93
|
|
89
94
|
class XtnDeEnProMax:
|
@@ -138,7 +143,8 @@ class XtnDeEnProMax:
|
|
138
143
|
result = decrypted.decode('utf-8')
|
139
144
|
return json.loads(result)
|
140
145
|
except (ValueError, KeyError, json.JSONDecodeError) as e:
|
141
|
-
raise ValueError(f"解密失败: {e}")
|
146
|
+
# raise ValueError(f"解密失败: {e}")
|
147
|
+
return {}
|
142
148
|
|
143
149
|
|
144
150
|
if __name__ == '__main__':
|
@@ -147,15 +153,15 @@ if __name__ == '__main__':
|
|
147
153
|
"task_type": "update_name",
|
148
154
|
"task_client": "tiktok",
|
149
155
|
}
|
150
|
-
sss = XtnDeEnAir.
|
151
|
-
print(sss)
|
152
|
-
print(XtnDeEnAir.en_data(key, sss))
|
153
|
-
|
154
|
-
key_pair = RSA.generate(2048)
|
155
|
-
private_key = key_pair.export_key()
|
156
|
-
public_key = key_pair.publickey().export_key()
|
157
|
-
print(private_key)
|
158
|
-
print(public_key)
|
159
|
-
sss = XtnDeEnProMax.encrypt_dict(public_key, data)
|
156
|
+
sss = XtnDeEnAir.encrypt_dict(key, data)
|
160
157
|
print(sss)
|
161
|
-
print(
|
158
|
+
print(XtnDeEnAir.decrypt_dict(key, sss))
|
159
|
+
|
160
|
+
# key_pair = RSA.generate(2048)
|
161
|
+
# private_key = key_pair.export_key()
|
162
|
+
# public_key = key_pair.publickey().export_key()
|
163
|
+
# print(private_key)
|
164
|
+
# print(public_key)
|
165
|
+
# sss = XtnDeEnProMax.encrypt_dict(public_key, data)
|
166
|
+
# print(sss)
|
167
|
+
# print(XtnDeEnProMax.decrypt_dict(private_key, sss))
|
@@ -0,0 +1,82 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
|
4
|
+
# 说明:
|
5
|
+
# win 操作
|
6
|
+
# History:
|
7
|
+
# Date Author Version Modification
|
8
|
+
# --------------------------------------------------------------------------------------------------
|
9
|
+
# 2025/8/11 xiatn V00.01.000 新建
|
10
|
+
# --------------------------------------------------------------------------------------------------
|
11
|
+
import ctypes
|
12
|
+
from ctypes import wintypes
|
13
|
+
|
14
|
+
user32 = ctypes.WinDLL("user32", use_last_error=True)
|
15
|
+
|
16
|
+
# 回调类型:BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
|
17
|
+
EnumWindowsProc = ctypes.WINFUNCTYPE(wintypes.BOOL, wintypes.HWND, wintypes.LPARAM)
|
18
|
+
|
19
|
+
# --- 明确声明所有用到的 WinAPI 的参数/返回类型 ---
|
20
|
+
user32.EnumWindows.argtypes = [EnumWindowsProc, wintypes.LPARAM]
|
21
|
+
user32.EnumWindows.restype = wintypes.BOOL
|
22
|
+
|
23
|
+
user32.GetWindowThreadProcessId.argtypes = [wintypes.HWND, ctypes.POINTER(wintypes.DWORD)]
|
24
|
+
user32.GetWindowThreadProcessId.restype = wintypes.DWORD
|
25
|
+
|
26
|
+
user32.IsWindowVisible.argtypes = [wintypes.HWND]
|
27
|
+
user32.IsWindowVisible.restype = wintypes.BOOL
|
28
|
+
|
29
|
+
user32.GetWindowTextLengthW.argtypes = [wintypes.HWND]
|
30
|
+
user32.GetWindowTextLengthW.restype = ctypes.c_int # 长度(TCHAR 数),可能为 0
|
31
|
+
|
32
|
+
user32.GetWindowTextW.argtypes = [wintypes.HWND, wintypes.LPWSTR, ctypes.c_int]
|
33
|
+
user32.GetWindowTextW.restype = ctypes.c_int # 实际拷贝的字符数
|
34
|
+
|
35
|
+
|
36
|
+
def enum_windows(only_visible=True):
|
37
|
+
"""
|
38
|
+
遍历顶层窗口,返回 [{hwnd, pid, title}, ...]
|
39
|
+
- only_visible=True 只返回可见窗口
|
40
|
+
"""
|
41
|
+
results = []
|
42
|
+
|
43
|
+
@EnumWindowsProc
|
44
|
+
def callback(hwnd, lparam):
|
45
|
+
try:
|
46
|
+
# 可选过滤
|
47
|
+
if only_visible and not user32.IsWindowVisible(hwnd):
|
48
|
+
return True # 继续枚举
|
49
|
+
|
50
|
+
# 取 PID
|
51
|
+
pid = wintypes.DWORD(0)
|
52
|
+
user32.GetWindowThreadProcessId(hwnd, ctypes.byref(pid))
|
53
|
+
|
54
|
+
# 取标题
|
55
|
+
length = user32.GetWindowTextLengthW(hwnd)
|
56
|
+
title = ""
|
57
|
+
if length > 0:
|
58
|
+
buf = ctypes.create_unicode_buffer(length + 1)
|
59
|
+
copied = user32.GetWindowTextW(hwnd, buf, length + 1)
|
60
|
+
if copied > 0:
|
61
|
+
title = buf.value
|
62
|
+
|
63
|
+
# 结果里再把 HWND 规范化为无符号整数,避免负数显示
|
64
|
+
results.append({
|
65
|
+
"hwnd": ctypes.c_size_t(hwnd).value,
|
66
|
+
"pid": pid.value,
|
67
|
+
"title": title
|
68
|
+
})
|
69
|
+
except Exception:
|
70
|
+
# 回调里不要把异常抛给 WinAPI,否则会出现 “Exception ignored on calling ctypes callback function”
|
71
|
+
pass
|
72
|
+
return True # 继续
|
73
|
+
|
74
|
+
user32.EnumWindows(callback, 0)
|
75
|
+
return results
|
76
|
+
|
77
|
+
|
78
|
+
if __name__ == "__main__":
|
79
|
+
pass
|
80
|
+
# 枚举win窗口获取句柄和pid
|
81
|
+
# for win in enum_windows(only_visible=True):
|
82
|
+
# print(win)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/.gitignore
RENAMED
File without changes
|
{xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/Dockerfile
RENAMED
File without changes
|
{xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/README.md
RENAMED
File without changes
|
{xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/app/app.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/server_run.py
RENAMED
File without changes
|
File without changes
|
{xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro/flask_demo/templates/uwsgi.ini
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{xtn-tools-pro-1.0.1.3.1 → xtn-tools-pro-1.0.1.3.3}/xtn_tools_pro.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|