bcmd 0.6.11__tar.gz → 0.6.13__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.

Potentially problematic release.


This version of bcmd might be problematic. Click here for more details.

Files changed (41) hide show
  1. {bcmd-0.6.11 → bcmd-0.6.13}/PKG-INFO +1 -1
  2. bcmd-0.6.13/bcmd/common/secret.py +69 -0
  3. {bcmd-0.6.11 → bcmd-0.6.13}/bcmd/tasks/docs.py +8 -1
  4. {bcmd-0.6.11 → bcmd-0.6.13}/bcmd.egg-info/PKG-INFO +1 -1
  5. {bcmd-0.6.11 → bcmd-0.6.13}/pyproject.toml +1 -1
  6. bcmd-0.6.11/bcmd/common/secret.py +0 -51
  7. {bcmd-0.6.11 → bcmd-0.6.13}/MANIFEST.in +0 -0
  8. {bcmd-0.6.11 → bcmd-0.6.13}/README.md +0 -0
  9. {bcmd-0.6.11 → bcmd-0.6.13}/bcmd/__init__.py +0 -0
  10. {bcmd-0.6.11 → bcmd-0.6.13}/bcmd/common/__init__.py +0 -0
  11. {bcmd-0.6.11 → bcmd-0.6.13}/bcmd/common/func.py +0 -0
  12. {bcmd-0.6.11 → bcmd-0.6.13}/bcmd/resources/project/main.py +0 -0
  13. {bcmd-0.6.11 → bcmd-0.6.13}/bcmd/tasks/__init__.py +0 -0
  14. {bcmd-0.6.11 → bcmd-0.6.13}/bcmd/tasks/bin.py +0 -0
  15. {bcmd-0.6.11 → bcmd-0.6.13}/bcmd/tasks/code.py +0 -0
  16. {bcmd-0.6.11 → bcmd-0.6.13}/bcmd/tasks/crypto.py +0 -0
  17. {bcmd-0.6.11 → bcmd-0.6.13}/bcmd/tasks/debian.py +0 -0
  18. {bcmd-0.6.11 → bcmd-0.6.13}/bcmd/tasks/download.py +0 -0
  19. {bcmd-0.6.11 → bcmd-0.6.13}/bcmd/tasks/image.py +0 -0
  20. {bcmd-0.6.11 → bcmd-0.6.13}/bcmd/tasks/json.py +0 -0
  21. {bcmd-0.6.11 → bcmd-0.6.13}/bcmd/tasks/lib.py +0 -0
  22. {bcmd-0.6.11 → bcmd-0.6.13}/bcmd/tasks/math.py +0 -0
  23. {bcmd-0.6.11 → bcmd-0.6.13}/bcmd/tasks/mirror.py +0 -0
  24. {bcmd-0.6.11 → bcmd-0.6.13}/bcmd/tasks/pdf.py +0 -0
  25. {bcmd-0.6.11 → bcmd-0.6.13}/bcmd/tasks/proxy.py +0 -0
  26. {bcmd-0.6.11 → bcmd-0.6.13}/bcmd/tasks/time.py +0 -0
  27. {bcmd-0.6.11 → bcmd-0.6.13}/bcmd/tasks/upgrade.py +0 -0
  28. {bcmd-0.6.11 → bcmd-0.6.13}/bcmd/tasks/wasabi.py +0 -0
  29. {bcmd-0.6.11 → bcmd-0.6.13}/bcmd/utils/__init__.py +0 -0
  30. {bcmd-0.6.11 → bcmd-0.6.13}/bcmd/utils/utils.py +0 -0
  31. {bcmd-0.6.11 → bcmd-0.6.13}/bcmd.egg-info/SOURCES.txt +0 -0
  32. {bcmd-0.6.11 → bcmd-0.6.13}/bcmd.egg-info/dependency_links.txt +0 -0
  33. {bcmd-0.6.11 → bcmd-0.6.13}/bcmd.egg-info/entry_points.txt +0 -0
  34. {bcmd-0.6.11 → bcmd-0.6.13}/bcmd.egg-info/requires.txt +0 -0
  35. {bcmd-0.6.11 → bcmd-0.6.13}/bcmd.egg-info/top_level.txt +0 -0
  36. {bcmd-0.6.11 → bcmd-0.6.13}/setup.cfg +0 -0
  37. {bcmd-0.6.11 → bcmd-0.6.13}/test/__init__.py +0 -0
  38. {bcmd-0.6.11 → bcmd-0.6.13}/test/conftest.py +0 -0
  39. {bcmd-0.6.11 → bcmd-0.6.13}/test/test_pdf.py +0 -0
  40. {bcmd-0.6.11 → bcmd-0.6.13}/test/test_proxy.py +0 -0
  41. {bcmd-0.6.11 → bcmd-0.6.13}/test/test_wasabi.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bcmd
3
- Version: 0.6.11
3
+ Version: 0.6.13
4
4
  Summary: Commands for Beni
5
5
  Author-email: Beni Mang <benimang@126.com>
6
6
  Maintainer-email: Beni Mang <benimang@126.com>
@@ -0,0 +1,69 @@
1
+ import tkinter as tk
2
+ from tkinter import messagebox
3
+ from typing import Any, TypedDict
4
+
5
+ from async_lru import alru_cache
6
+ from beni import bcrypto, btask
7
+ from beni.bform import BForm
8
+
9
+
10
+ class PypiSecret(TypedDict):
11
+ username: str
12
+ password: str
13
+
14
+
15
+ @alru_cache
16
+ async def getPypi(value: str = '') -> PypiSecret:
17
+ return _getData(
18
+ '请输入 PYPI 密钥信息',
19
+ value or 'QbuF2mV/lqovtF5dskZGD7qHknYbNuF2QseWRtWxLZTPrC/jL1tcxV8JEKaRjLsu46PxJZ7zepJwggnUTIWnEAoV5VtgP2/hbuzxxHha8817kR5c65H9fXm8eOal7DYXsUoGPQMnm59UWNXUKjmIaP4sn9nySFlRYqa8sEZSbYQ4N0NL35Dpj1e3wyQxJ+7h2jwKAz50Hh8G4yAM3/js9+NUe4ymts+UXcwsP3ADIBMkzjnFc0lEYg2d+fw0A74XWCvoZPoGqHZR/THUOVNAYxoGgDzP4SPIk1XsmtpxvfO/DpJd/Cg/0fB3MYagGKI1+m6Bxqhvd1I/lf0YbM5y4E4=',
20
+ )
21
+
22
+
23
+ class QiniuSecret(TypedDict):
24
+ bucket: str
25
+ baseUrl: str
26
+ ak: str
27
+ sk: str
28
+
29
+
30
+ @alru_cache
31
+ async def getQiniu(value: str = '') -> QiniuSecret:
32
+ return _getData(
33
+ '请输入 七牛云 密钥信息',
34
+ value or 'vNroFKeKklrdcJ89suFm+iyuJsq/cyUB5+QWoeeiMc/J0oSLF9cg5rqbK1IRxF0cCQ8KmkQQhdVa+PI6kuTBhoSH6IviVTylzAOrJywEccz9jWkJkW28Y9Vo4ePZmfWf/j7wdxNB144z234KD8IxJn4lR2A0L9JN5kk1o1/hpcydXL74FNtt03lYL/E3WVcvpUfw37mri2HMYOfUw81dRwW35/hMuQjtq1BBrKrIsSKTHH44tROMcgyvt+Qy292AtDBcsYiZxBKhQtBFPMq/vUs=',
35
+ )
36
+
37
+
38
+ def _getData(title: str, content: str) -> Any:
39
+
40
+ class PasswordForm(BForm):
41
+ result: dict[str, Any] = {}
42
+
43
+ def __init__(self):
44
+ super().__init__(title=title)
45
+ self.passwordVar = tk.StringVar(value='')
46
+ ary = content.split(' ')
47
+ if len(ary) > 1:
48
+ self.addLabel('提示', ary[0])
49
+ self.addEntry('密码', self.passwordVar, width=30, password=True, focus=True, command=self.onBtn)
50
+ self.addBtn('确定', self.onBtn)
51
+
52
+ def onBtn(self):
53
+ try:
54
+ self.result.update(
55
+ bcrypto.decryptJson(content, self.passwordVar.get())
56
+ )
57
+ self.destroy()
58
+ except:
59
+ messagebox.showerror('密码错误', '密码错误,请重新输入')
60
+
61
+ def getResult(self):
62
+ return self.result
63
+
64
+ result = PasswordForm().run()
65
+
66
+ if result is None:
67
+ btask.abort('用户取消操作')
68
+ else:
69
+ return result
@@ -98,7 +98,10 @@ async def userInput():
98
98
  def getResult(self):
99
99
  return self.varIsUpload.get(), self.varPassword.get()
100
100
 
101
- isUpload, password = BuildForm().run()
101
+ result = BuildForm().run()
102
+ if not result:
103
+ btask.abort('用户取消操作')
104
+ isUpload, password = result
102
105
 
103
106
  # 配置里面每个字段都尝试解密(实际效率较低但不影响使用)
104
107
  for k, v in conf.items():
@@ -142,6 +145,10 @@ async def makeDeploy(outputPath: Path):
142
145
  # 替换文件内容
143
146
  content = await bfile.readText(file)
144
147
  oldContent = content
148
+ try:
149
+ content = bcrypto.decryptText(content, password)
150
+ except:
151
+ pass
145
152
  for k, v in dataDict.items():
146
153
  content = content.replace(f'{{{k}}}', str(v))
147
154
  if oldContent != content:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bcmd
3
- Version: 0.6.11
3
+ Version: 0.6.13
4
4
  Summary: Commands for Beni
5
5
  Author-email: Beni Mang <benimang@126.com>
6
6
  Maintainer-email: Beni Mang <benimang@126.com>
@@ -3,7 +3,7 @@
3
3
 
4
4
  [project]
5
5
  name = 'bcmd'
6
- version = '0.6.11'
6
+ version = '0.6.13'
7
7
  description = 'Commands for Beni'
8
8
  requires-python = '>=3.10'
9
9
  keywords = ['benimang', 'beni', 'bcmd']
@@ -1,51 +0,0 @@
1
- import getpass
2
- from typing import Any, TypedDict, cast
3
-
4
- from async_lru import alru_cache
5
- from beni import bcrypto, btask
6
- from beni.bcolor import printRed
7
-
8
-
9
- class PypiSecret(TypedDict):
10
- username: str
11
- password: str
12
-
13
-
14
- @alru_cache
15
- async def getPypi(value: str = '') -> PypiSecret:
16
- return cast(
17
- Any,
18
- _getData(value or 'QbuF2mV/lqovtF5dskZGD7qHknYbNuF2QseWRtWxLZTPrC/jL1tcxV8JEKaRjLsu46PxJZ7zepJwggnUTIWnEAoV5VtgP2/hbuzxxHha8817kR5c65H9fXm8eOal7DYXsUoGPQMnm59UWNXUKjmIaP4sn9nySFlRYqa8sEZSbYQ4N0NL35Dpj1e3wyQxJ+7h2jwKAz50Hh8G4yAM3/js9+NUe4ymts+UXcwsP3ADIBMkzjnFc0lEYg2d+fw0A74XWCvoZPoGqHZR/THUOVNAYxoGgDzP4SPIk1XsmtpxvfO/DpJd/Cg/0fB3MYagGKI1+m6Bxqhvd1I/lf0YbM5y4E4='),
19
- )
20
-
21
-
22
- class QiniuSecret(TypedDict):
23
- bucket: str
24
- baseUrl: str
25
- ak: str
26
- sk: str
27
-
28
-
29
- @alru_cache
30
- async def getQiniu(value: str = '') -> QiniuSecret:
31
- return cast(
32
- Any,
33
- _getData(value or 'vNroFKeKklrdcJ89suFm+iyuJsq/cyUB5+QWoeeiMc/J0oSLF9cg5rqbK1IRxF0cCQ8KmkQQhdVa+PI6kuTBhoSH6IviVTylzAOrJywEccz9jWkJkW28Y9Vo4ePZmfWf/j7wdxNB144z234KD8IxJn4lR2A0L9JN5kk1o1/hpcydXL74FNtt03lYL/E3WVcvpUfw37mri2HMYOfUw81dRwW35/hMuQjtq1BBrKrIsSKTHH44tROMcgyvt+Qy292AtDBcsYiZxBKhQtBFPMq/vUs='),
34
- )
35
-
36
-
37
- def _getData(content: str) -> dict[str, Any]:
38
- index = content.find(' ')
39
- if index > -1:
40
- tips = f'请输入密码({content[:index]}):'
41
- else:
42
- tips = '请输入密码:'
43
- while True:
44
- try:
45
- pwd = getpass.getpass(tips)
46
- return bcrypto.decryptJson(content, pwd)
47
- except KeyboardInterrupt:
48
- print('')
49
- btask.abort('用户操作取消')
50
- except BaseException:
51
- printRed('密码错误')
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
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