ensec-cli 1.0.1__tar.gz → 1.0.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.
- {ensec_cli-1.0.1 → ensec_cli-1.0.3}/PKG-INFO +1 -1
- ensec_cli-1.0.3/ensec_cli/__init__.py +1 -0
- {ensec_cli-1.0.1 → ensec_cli-1.0.3}/ensec_cli/cli.py +9 -2
- ensec_cli-1.0.3/ensec_cli/conf_load.py +71 -0
- {ensec_cli-1.0.1 → ensec_cli-1.0.3}/ensec_cli.egg-info/PKG-INFO +1 -1
- {ensec_cli-1.0.1 → ensec_cli-1.0.3}/ensec_cli.egg-info/SOURCES.txt +1 -0
- {ensec_cli-1.0.1 → ensec_cli-1.0.3}/pyproject.toml +1 -1
- ensec_cli-1.0.1/ensec_cli/__init__.py +0 -1
- {ensec_cli-1.0.1 → ensec_cli-1.0.3}/LICENSE +0 -0
- {ensec_cli-1.0.1 → ensec_cli-1.0.3}/README.md +0 -0
- {ensec_cli-1.0.1 → ensec_cli-1.0.3}/ensec_cli/esdcompress.py +0 -0
- {ensec_cli-1.0.1 → ensec_cli-1.0.3}/ensec_cli/passchk.py +0 -0
- {ensec_cli-1.0.1 → ensec_cli-1.0.3}/ensec_cli/rsa_encryptor.py +0 -0
- {ensec_cli-1.0.1 → ensec_cli-1.0.3}/ensec_cli/rsa_signer.py +0 -0
- {ensec_cli-1.0.1 → ensec_cli-1.0.3}/ensec_cli/utils.py +0 -0
- {ensec_cli-1.0.1 → ensec_cli-1.0.3}/ensec_cli/wavencode.py +0 -0
- {ensec_cli-1.0.1 → ensec_cli-1.0.3}/ensec_cli.egg-info/dependency_links.txt +0 -0
- {ensec_cli-1.0.1 → ensec_cli-1.0.3}/ensec_cli.egg-info/entry_points.txt +0 -0
- {ensec_cli-1.0.1 → ensec_cli-1.0.3}/ensec_cli.egg-info/requires.txt +0 -0
- {ensec_cli-1.0.1 → ensec_cli-1.0.3}/ensec_cli.egg-info/top_level.txt +0 -0
- {ensec_cli-1.0.1 → ensec_cli-1.0.3}/setup.cfg +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.0.3"
|
|
@@ -15,10 +15,12 @@ from . import rsa_signer
|
|
|
15
15
|
from . import wavencode
|
|
16
16
|
from . import rsa_encryptor
|
|
17
17
|
from pathlib import Path
|
|
18
|
-
|
|
18
|
+
from .conf_load import load_config
|
|
19
19
|
|
|
20
20
|
# OKならそのまま続行
|
|
21
21
|
|
|
22
|
+
conf=load_config()
|
|
23
|
+
|
|
22
24
|
BLOCKCHAIN_HEADER = b'BLOCKCHAIN_DATA_START\n'
|
|
23
25
|
def _format_bytes(num: int) -> str:
|
|
24
26
|
units = ["B", "KB", "MB", "GB", "TB", "PB"]
|
|
@@ -209,7 +211,12 @@ def cli_decrypt(file_path, password, memo):
|
|
|
209
211
|
print("❌ Error: Decryption failed. The password may be incorrect or the file may be tampered with.")
|
|
210
212
|
sys.exit(1)
|
|
211
213
|
|
|
212
|
-
|
|
214
|
+
|
|
215
|
+
if conf==True:
|
|
216
|
+
output_file = file_path.replace(".vdec.wav", "_decrypted").replace(".vdec", "_decrypted")
|
|
217
|
+
else:
|
|
218
|
+
output_file = file_path.replace(".vdec.wav", "").replace(".vdec", "")
|
|
219
|
+
|
|
213
220
|
with open(output_file, 'wb') as f:
|
|
214
221
|
f.write(plaintext)
|
|
215
222
|
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import configparser
|
|
2
|
+
import os
|
|
3
|
+
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
import os
|
|
6
|
+
|
|
7
|
+
APP_NAME = "ENSEC"
|
|
8
|
+
|
|
9
|
+
def config_path():
|
|
10
|
+
if os.name == "nt":
|
|
11
|
+
home = Path.home()
|
|
12
|
+
base = home / ".local" / "share" / APP_NAME
|
|
13
|
+
else:
|
|
14
|
+
xdg_data_home = Path(
|
|
15
|
+
os.getenv(
|
|
16
|
+
"XDG_DATA_HOME",
|
|
17
|
+
Path.home() / ".local" / "share"
|
|
18
|
+
)
|
|
19
|
+
)
|
|
20
|
+
base = xdg_data_home / APP_NAME
|
|
21
|
+
|
|
22
|
+
base.mkdir(parents=True, exist_ok=True)
|
|
23
|
+
|
|
24
|
+
return base / "config.ini"
|
|
25
|
+
|
|
26
|
+
CONFIG_FILE = str(config_path())
|
|
27
|
+
|
|
28
|
+
def load_config():
|
|
29
|
+
"""
|
|
30
|
+
config.ini を読み込み、
|
|
31
|
+
復号化後ファイル名に _decrypted を付けるかどうかを返す。
|
|
32
|
+
|
|
33
|
+
戻り値:
|
|
34
|
+
bool
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
# デフォルト設定
|
|
38
|
+
default_config = {
|
|
39
|
+
"add_decrypted_suffix": "true"
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
config = configparser.ConfigParser()
|
|
43
|
+
|
|
44
|
+
# configファイルが存在しない場合は自動生成
|
|
45
|
+
if not os.path.exists(CONFIG_FILE):
|
|
46
|
+
config["Settings"] = default_config
|
|
47
|
+
|
|
48
|
+
with open(CONFIG_FILE, "w", encoding="utf-8") as f:
|
|
49
|
+
config.write(f)
|
|
50
|
+
|
|
51
|
+
print(f"[INFO] {CONFIG_FILE} を作成しました")
|
|
52
|
+
|
|
53
|
+
# 読み込み
|
|
54
|
+
config.read(CONFIG_FILE, encoding="utf-8")
|
|
55
|
+
|
|
56
|
+
# bool型として取得
|
|
57
|
+
add_suffix = config.getboolean(
|
|
58
|
+
"Settings",
|
|
59
|
+
"add_decrypted_suffix",
|
|
60
|
+
fallback=True
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
return add_suffix
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
# 使用例
|
|
67
|
+
if __name__ == "__main__":
|
|
68
|
+
if load_config():
|
|
69
|
+
print("復号化後ファイル名に _decrypted を付けます")
|
|
70
|
+
else:
|
|
71
|
+
print("復号化後ファイル名に _decrypted を付けません")
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.0.1"
|
|
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
|