bcmd 0.5.9__tar.gz → 0.5.11__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.
- {bcmd-0.5.9 → bcmd-0.5.11}/PKG-INFO +2 -2
- {bcmd-0.5.9 → bcmd-0.5.11}/bcmd/tasks/__init__.py +1 -0
- {bcmd-0.5.9 → bcmd-0.5.11}/bcmd/tasks/crypto.py +4 -15
- bcmd-0.5.11/bcmd/tasks/wasabi.py +66 -0
- {bcmd-0.5.9 → bcmd-0.5.11}/bcmd.egg-info/PKG-INFO +2 -2
- {bcmd-0.5.9 → bcmd-0.5.11}/bcmd.egg-info/SOURCES.txt +2 -1
- {bcmd-0.5.9 → bcmd-0.5.11}/bcmd.egg-info/requires.txt +1 -1
- {bcmd-0.5.9 → bcmd-0.5.11}/pyproject.toml +2 -2
- {bcmd-0.5.9 → bcmd-0.5.11}/MANIFEST.in +0 -0
- {bcmd-0.5.9 → bcmd-0.5.11}/README.md +0 -0
- {bcmd-0.5.9 → bcmd-0.5.11}/bcmd/__init__.py +0 -0
- {bcmd-0.5.9 → bcmd-0.5.11}/bcmd/common/__init__.py +0 -0
- {bcmd-0.5.9 → bcmd-0.5.11}/bcmd/common/func.py +0 -0
- {bcmd-0.5.9 → bcmd-0.5.11}/bcmd/common/password.py +0 -0
- {bcmd-0.5.9 → bcmd-0.5.11}/bcmd/main.py +0 -0
- {bcmd-0.5.9 → bcmd-0.5.11}/bcmd/resources/project/.gitignore +0 -0
- {bcmd-0.5.9 → bcmd-0.5.11}/bcmd/resources/project/.vscode/launch.json +0 -0
- {bcmd-0.5.9 → bcmd-0.5.11}/bcmd/resources/project/.vscode/settings.json +0 -0
- {bcmd-0.5.9 → bcmd-0.5.11}/bcmd/resources/project/.vscode/tasks.json +0 -0
- {bcmd-0.5.9 → bcmd-0.5.11}/bcmd/resources/project/main.py +0 -0
- {bcmd-0.5.9 → bcmd-0.5.11}/bcmd/tasks/bin.py +0 -0
- {bcmd-0.5.9 → bcmd-0.5.11}/bcmd/tasks/code.py +0 -0
- {bcmd-0.5.9 → bcmd-0.5.11}/bcmd/tasks/debian.py +0 -0
- {bcmd-0.5.9 → bcmd-0.5.11}/bcmd/tasks/download.py +0 -0
- {bcmd-0.5.9 → bcmd-0.5.11}/bcmd/tasks/image.py +0 -0
- {bcmd-0.5.9 → bcmd-0.5.11}/bcmd/tasks/json.py +0 -0
- {bcmd-0.5.9 → bcmd-0.5.11}/bcmd/tasks/lib.py +0 -0
- {bcmd-0.5.9 → bcmd-0.5.11}/bcmd/tasks/math.py +0 -0
- {bcmd-0.5.9 → bcmd-0.5.11}/bcmd/tasks/mirror.py +0 -0
- {bcmd-0.5.9 → bcmd-0.5.11}/bcmd/tasks/pdf.py +0 -0
- {bcmd-0.5.9 → bcmd-0.5.11}/bcmd/tasks/project.py +0 -0
- {bcmd-0.5.9 → bcmd-0.5.11}/bcmd/tasks/proxy.py +0 -0
- {bcmd-0.5.9 → bcmd-0.5.11}/bcmd/tasks/time.py +0 -0
- {bcmd-0.5.9 → bcmd-0.5.11}/bcmd/tasks/upgrade.py +0 -0
- {bcmd-0.5.9 → bcmd-0.5.11}/bcmd/tasks/venv.py +0 -0
- {bcmd-0.5.9 → bcmd-0.5.11}/bcmd.egg-info/dependency_links.txt +0 -0
- {bcmd-0.5.9 → bcmd-0.5.11}/bcmd.egg-info/entry_points.txt +0 -0
- {bcmd-0.5.9 → bcmd-0.5.11}/bcmd.egg-info/top_level.txt +0 -0
- {bcmd-0.5.9 → bcmd-0.5.11}/setup.cfg +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: bcmd
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.11
|
|
4
4
|
Summary: Commands for Beni
|
|
5
5
|
Author-email: Beni Mang <benimang@126.com>
|
|
6
6
|
Maintainer-email: Beni Mang <benimang@126.com>
|
|
7
7
|
Keywords: benimang,beni,bcmd
|
|
8
8
|
Requires-Python: >=3.10
|
|
9
|
-
Requires-Dist: benimang==0.7.
|
|
9
|
+
Requires-Dist: benimang==0.7.13
|
|
10
10
|
Requires-Dist: build
|
|
11
11
|
Requires-Dist: cryptography
|
|
12
12
|
Requires-Dist: pathspec
|
|
@@ -7,6 +7,7 @@ import pyperclip
|
|
|
7
7
|
import typer
|
|
8
8
|
from beni import bcolor, bcrypto, btask
|
|
9
9
|
from beni.bfunc import syncCall
|
|
10
|
+
from beni.binput import genPassword
|
|
10
11
|
from rich.console import Console
|
|
11
12
|
|
|
12
13
|
app: Final = btask.newSubApp('加密(v2)')
|
|
@@ -19,7 +20,7 @@ async def encrypt_text():
|
|
|
19
20
|
content = pyperclip.paste()
|
|
20
21
|
assert content, '剪贴板内容不能为空'
|
|
21
22
|
bcolor.printGreen(content)
|
|
22
|
-
password =
|
|
23
|
+
password = genPassword()
|
|
23
24
|
result = bcrypto.encryptText(content, password)
|
|
24
25
|
pyperclip.copy(result)
|
|
25
26
|
print('密文已复制到剪贴板')
|
|
@@ -55,7 +56,7 @@ async def encrypt_json():
|
|
|
55
56
|
except:
|
|
56
57
|
return btask.abort('错误:剪贴板内容必须是JSON格式', content)
|
|
57
58
|
Console().print_json(data=data, indent=4, ensure_ascii=False, sort_keys=True)
|
|
58
|
-
password =
|
|
59
|
+
password = genPassword()
|
|
59
60
|
result = bcrypto.encryptJson(data, password)
|
|
60
61
|
pyperclip.copy(result)
|
|
61
62
|
print('密文已复制到剪贴板')
|
|
@@ -87,7 +88,7 @@ async def encrypt_file(
|
|
|
87
88
|
):
|
|
88
89
|
'加密文件(文件路径使用剪贴板内容)'
|
|
89
90
|
assert file.is_file(), '文件不存在'
|
|
90
|
-
password =
|
|
91
|
+
password = genPassword()
|
|
91
92
|
await bcrypto.encryptFile(file, password)
|
|
92
93
|
bcolor.printGreen('OK')
|
|
93
94
|
|
|
@@ -102,15 +103,3 @@ async def decrypt_file(
|
|
|
102
103
|
password = getpass.getpass('输入密码:')
|
|
103
104
|
await bcrypto.decryptFile(file, password)
|
|
104
105
|
bcolor.printGreen('OK')
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
# ------------------------------------------------------------------------------------
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
def _genPassword():
|
|
111
|
-
password = ''
|
|
112
|
-
while not password:
|
|
113
|
-
password = getpass.getpass('输入密码:')
|
|
114
|
-
while password != getpass.getpass('再次密码:'):
|
|
115
|
-
pass
|
|
116
|
-
return password
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import getpass
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
from typing import Final
|
|
4
|
+
|
|
5
|
+
import typer
|
|
6
|
+
from beni import bcolor, bcrypto, bfile, bpath, btask, bzip
|
|
7
|
+
from beni.bfunc import shuffleSequence, syncCall
|
|
8
|
+
from beni.binput import genPassword
|
|
9
|
+
|
|
10
|
+
app: Final = btask.newSubApp('Wasabi 工具')
|
|
11
|
+
|
|
12
|
+
SEP = f'{chr(852)}{chr(322)}{chr(470)}'.encode()
|
|
13
|
+
MAX_ENCRYPT_SIZE = 199 * 1024
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@app.command()
|
|
17
|
+
@syncCall
|
|
18
|
+
async def to_dir(
|
|
19
|
+
file: Path = typer.Argument(Path.cwd(), help='工作文件'),
|
|
20
|
+
password: str = typer.Option('', '--password', '-p', help='密码'),
|
|
21
|
+
):
|
|
22
|
+
'生成目录'
|
|
23
|
+
assert file.is_file(), f'不是文件 {file}'
|
|
24
|
+
workspace = file.parent / file.stem
|
|
25
|
+
assert not workspace.exists(), f'目录已存在 {workspace}'
|
|
26
|
+
password = password or getpass.getpass('请输入密码: ')
|
|
27
|
+
with bpath.useTempFile() as tempFile:
|
|
28
|
+
data = await bfile.readBytes(file)
|
|
29
|
+
if SEP not in data:
|
|
30
|
+
data = bcrypto.decrypt(data, password)
|
|
31
|
+
else:
|
|
32
|
+
partA, partB = data.split(SEP)
|
|
33
|
+
partA = bcrypto.decrypt(partA, password)
|
|
34
|
+
data = partA + partB
|
|
35
|
+
data = shuffleSequence(data)
|
|
36
|
+
await bfile.writeBytes(tempFile, data)
|
|
37
|
+
await bzip.sevenUnzip(tempFile, workspace)
|
|
38
|
+
bcolor.printGreen(workspace)
|
|
39
|
+
bcolor.printGreen('OK')
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@app.command()
|
|
43
|
+
@syncCall
|
|
44
|
+
async def to_file(
|
|
45
|
+
workspace: Path = typer.Argument(Path.cwd(), help='工作目录'),
|
|
46
|
+
password: str = typer.Option('', '--password', '-p', help='密码'),
|
|
47
|
+
):
|
|
48
|
+
'生成文件'
|
|
49
|
+
assert workspace.is_dir(), f'不是目录 {workspace}'
|
|
50
|
+
zipFile = workspace.parent / f'{workspace.name}.dat'
|
|
51
|
+
assert not zipFile.exists(), f'文件已存在 {zipFile}'
|
|
52
|
+
password = password or genPassword()
|
|
53
|
+
with bpath.useTempFile() as tempFile:
|
|
54
|
+
await bzip.sevenZipFolder(tempFile, workspace)
|
|
55
|
+
data = await bfile.readBytes(tempFile)
|
|
56
|
+
bpath.remove(tempFile)
|
|
57
|
+
data = shuffleSequence(data)
|
|
58
|
+
if len(data) < MAX_ENCRYPT_SIZE:
|
|
59
|
+
data = bcrypto.encrypt(data, password)
|
|
60
|
+
else:
|
|
61
|
+
partA, partB = data[:MAX_ENCRYPT_SIZE], data[MAX_ENCRYPT_SIZE:]
|
|
62
|
+
partA = bcrypto.encrypt(partA, password)
|
|
63
|
+
data = partA + SEP + partB
|
|
64
|
+
await bfile.writeBytes(zipFile, data)
|
|
65
|
+
bcolor.printGreen(zipFile)
|
|
66
|
+
bcolor.printGreen('OK')
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: bcmd
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.11
|
|
4
4
|
Summary: Commands for Beni
|
|
5
5
|
Author-email: Beni Mang <benimang@126.com>
|
|
6
6
|
Maintainer-email: Beni Mang <benimang@126.com>
|
|
7
7
|
Keywords: benimang,beni,bcmd
|
|
8
8
|
Requires-Python: >=3.10
|
|
9
|
-
Requires-Dist: benimang==0.7.
|
|
9
|
+
Requires-Dist: benimang==0.7.13
|
|
10
10
|
Requires-Dist: build
|
|
11
11
|
Requires-Dist: cryptography
|
|
12
12
|
Requires-Dist: pathspec
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
[project]
|
|
5
5
|
name = 'bcmd'
|
|
6
|
-
version = '0.5.
|
|
6
|
+
version = '0.5.11'
|
|
7
7
|
description = 'Commands for Beni'
|
|
8
8
|
requires-python = '>=3.10'
|
|
9
9
|
keywords = ['benimang', 'beni', 'bcmd']
|
|
@@ -12,7 +12,7 @@ maintainers = [{ name = 'Beni Mang', email = 'benimang@126.com' }]
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
dependencies = [
|
|
15
|
-
'benimang==0.7.
|
|
15
|
+
'benimang==0.7.13',
|
|
16
16
|
'build',
|
|
17
17
|
'cryptography',
|
|
18
18
|
'pathspec',
|
|
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
|