flyshell 1.5.9__tar.gz → 1.5.10__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.
- {flyshell-1.5.9/src/flyshell.egg-info → flyshell-1.5.10}/PKG-INFO +1 -1
- {flyshell-1.5.9 → flyshell-1.5.10}/src/flyshell/builtin/fs.py +0 -10
- {flyshell-1.5.9 → flyshell-1.5.10}/src/flyshell/builtin/system.py +1 -40
- {flyshell-1.5.9 → flyshell-1.5.10}/src/flyshell/constants.py +3 -3
- {flyshell-1.5.9 → flyshell-1.5.10}/src/flyshell/startup/loader.py +0 -15
- {flyshell-1.5.9 → flyshell-1.5.10/src/flyshell.egg-info}/PKG-INFO +1 -1
- {flyshell-1.5.9 → flyshell-1.5.10}/src/flyshell.egg-info/SOURCES.txt +0 -1
- {flyshell-1.5.9 → flyshell-1.5.10}/tests/test_env.py +0 -18
- flyshell-1.5.9/tests/test_security.py +0 -42
- {flyshell-1.5.9 → flyshell-1.5.10}/LICENSE +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/MANIFEST.in +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/README.md +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/c_src/diskops/diskops.c +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/c_src/diskops/posix/cat.c +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/c_src/diskops/posix/cp.c +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/c_src/diskops/posix/dir.c +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/c_src/diskops/posix/mkdir.c +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/c_src/diskops/posix/mv.c +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/c_src/diskops/posix/rename.c +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/c_src/diskops/posix/rm.c +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/c_src/diskops/posix/rmdir.c +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/c_src/diskops/posix/touch.c +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/c_src/diskops/shared/dir_types.c +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/c_src/diskops/shared/dir_types.h +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/c_src/diskops/shared/native_errors.h +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/c_src/diskops/shared/win32_utf.h +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/c_src/diskops/win32/cat.c +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/c_src/diskops/win32/cp.c +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/c_src/diskops/win32/dir.c +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/c_src/diskops/win32/mkdir.c +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/c_src/diskops/win32/mv.c +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/c_src/diskops/win32/rename.c +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/c_src/diskops/win32/rm.c +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/c_src/diskops/win32/rmdir.c +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/c_src/diskops/win32/touch.c +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/pyproject.toml +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/setup.cfg +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/setup.py +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/src/flyshell/__init__.py +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/src/flyshell/abstract/__init__.py +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/src/flyshell/abstract/base_cmd.py +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/src/flyshell/abstract/base_plugin.py +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/src/flyshell/abstract/parent_cmd.py +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/src/flyshell/accounts/__init__.py +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/src/flyshell/accounts/auth.py +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/src/flyshell/bin/__init__.py +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/src/flyshell/builtin/__init__.py +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/src/flyshell/builtin/pkg.py +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/src/flyshell/builtin/utils.py +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/src/flyshell/core/__init__.py +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/src/flyshell/core/console.py +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/src/flyshell/core/data.py +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/src/flyshell/core/directory.py +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/src/flyshell/main.py +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/src/flyshell/native/__init__.py +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/src/flyshell/native/diskops_bridge.py +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/src/flyshell/native/diskops_handler.py +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/src/flyshell/native/legacy/__init__.py +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/src/flyshell/native/legacy/diskops.py +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/src/flyshell/startup/__init__.py +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/src/flyshell/startup/deps.py +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/src/flyshell/startup/env.py +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/src/flyshell/startup/seasonal.py +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/src/flyshell.egg-info/dependency_links.txt +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/src/flyshell.egg-info/entry_points.txt +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/src/flyshell.egg-info/requires.txt +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/src/flyshell.egg-info/top_level.txt +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/tests/test_auth.py +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/tests/test_data.py +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/tests/test_deps.py +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/tests/test_directory.py +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/tests/test_diskops_ext.py +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/tests/test_diskops_lgc.py +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/tests/test_fs.py +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/tests/test_loader.py +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/tests/test_pkg.py +0 -0
- {flyshell-1.5.9 → flyshell-1.5.10}/tests/test_utils.py +0 -0
|
@@ -35,16 +35,6 @@ class FsDel(BaseCmd):
|
|
|
35
35
|
data.clear_history()
|
|
36
36
|
return (0, "\nCommand history purged successfully.\n")
|
|
37
37
|
return (1, "\nAction cancelled.\n")
|
|
38
|
-
case "config":
|
|
39
|
-
if len(args) < 2:
|
|
40
|
-
return (
|
|
41
|
-
1,
|
|
42
|
-
"\nCommand Error: Please specify a configuration key to delete.\n",
|
|
43
|
-
)
|
|
44
|
-
key = args[1]
|
|
45
|
-
if data.delete_config(key):
|
|
46
|
-
return (0, f"\nConfig setting '{key}' deleted.\n")
|
|
47
|
-
return (1, f"\nConfig Error: Setting '{key}' not found.\n")
|
|
48
38
|
case "plugin":
|
|
49
39
|
if len(args) < 2:
|
|
50
40
|
return (
|
|
@@ -2,10 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from flyshell import constants as c
|
|
4
4
|
from flyshell.abstract.base_cmd import BaseCmd
|
|
5
|
-
from flyshell.accounts import auth
|
|
6
|
-
from flyshell.core import data
|
|
7
5
|
|
|
8
|
-
import getpass
|
|
9
6
|
import os
|
|
10
7
|
import shutil
|
|
11
8
|
import subprocess
|
|
@@ -75,45 +72,9 @@ class SysExe(BaseCmd):
|
|
|
75
72
|
def execute(self, args):
|
|
76
73
|
if not args:
|
|
77
74
|
return (1, "\nCommand Error: 'sys' requires at least 1 parameter(s).\n")
|
|
78
|
-
if args[0] in ["-f", "--force"]:
|
|
79
|
-
override = True
|
|
80
|
-
cmd_args = args[1:]
|
|
81
|
-
if not cmd_args:
|
|
82
|
-
return (1, "\nCommand Error: 'sys' requires at least 1 parameter(s).\n")
|
|
83
|
-
else:
|
|
84
|
-
override = False
|
|
85
|
-
cmd_args = args
|
|
86
|
-
tokens_lower = [token.lower().strip("\"'") for token in cmd_args]
|
|
87
|
-
|
|
88
|
-
def matches_pattern(target_set):
|
|
89
|
-
for token in tokens_lower:
|
|
90
|
-
base_name = os.path.splitext(os.path.basename(token))[0]
|
|
91
|
-
if token in target_set or base_name in target_set:
|
|
92
|
-
return True
|
|
93
|
-
return False
|
|
94
|
-
|
|
95
|
-
if matches_pattern(c.BLOCKED_COMMANDS):
|
|
96
|
-
cmd_display = " ".join(cmd_args)
|
|
97
|
-
return (
|
|
98
|
-
1,
|
|
99
|
-
(
|
|
100
|
-
"\nSecurity Error: Flyshell has blocked execution of this command.\n"
|
|
101
|
-
f"This command '{cmd_display}' is permanently restricted by Flyshell safety policy.\n"
|
|
102
|
-
"Flyshell has blocked your command to prevent damage to your computer.\n"
|
|
103
|
-
),
|
|
104
|
-
)
|
|
105
|
-
if not override and matches_pattern(c.DANGER_COMMANDS):
|
|
106
|
-
password = getpass.getpass(
|
|
107
|
-
"\nThis command is restricted. To execute, enter your password: "
|
|
108
|
-
)
|
|
109
|
-
auth_info = data.get_auth() or {}
|
|
110
|
-
stored_hash = auth_info.get("hash")
|
|
111
|
-
stored_salt = auth_info.get("salt")
|
|
112
|
-
if not auth.verify_password(stored_hash, stored_salt, password):
|
|
113
|
-
return (1, "\nAccount Error: Password does not match.\n")
|
|
114
75
|
try:
|
|
115
76
|
print()
|
|
116
|
-
raw_cmd = " ".join(
|
|
77
|
+
raw_cmd = " ".join(args)
|
|
117
78
|
result = subprocess.run(raw_cmd, shell=True)
|
|
118
79
|
print()
|
|
119
80
|
return (result.returncode, "")
|
|
@@ -62,21 +62,6 @@ def scan_plugins(plugin_folder=None):
|
|
|
62
62
|
)
|
|
63
63
|
break
|
|
64
64
|
ctx = build_context(resolved_name, default_name, file_path)
|
|
65
|
-
required_keys = getattr(obj, "api_keys", None) or []
|
|
66
|
-
found_keys = ctx["api_keys"]
|
|
67
|
-
found_keys_lower = {k.lower(): v for k, v in found_keys.items()}
|
|
68
|
-
missing_keys = [
|
|
69
|
-
k for k in required_keys if k.lower() not in found_keys_lower
|
|
70
|
-
]
|
|
71
|
-
if missing_keys:
|
|
72
|
-
env_file = ctx["env_path"]
|
|
73
|
-
print(
|
|
74
|
-
f"\n⚠️ API Key Error - Plugin '{resolved_name}' is missing required key(s): {', '.join(missing_keys)}"
|
|
75
|
-
)
|
|
76
|
-
print(f"Please define them in: {env_file} as:")
|
|
77
|
-
for mk in missing_keys:
|
|
78
|
-
print(f"{default_name}_{mk}=<your_key>")
|
|
79
|
-
print("You can do this once Flyshell has booted.")
|
|
80
65
|
candidates.setdefault(resolved_name, []).append(
|
|
81
66
|
(obj, ctx, file_path)
|
|
82
67
|
)
|
|
@@ -67,24 +67,6 @@ def test_loader_populates_context_correctly(tmp_path, mock_env_file, monkeypatch
|
|
|
67
67
|
assert plugin.get_api_key("token") == "token123"
|
|
68
68
|
|
|
69
69
|
|
|
70
|
-
def test_loader_rejects_plugin_with_missing_keys(
|
|
71
|
-
tmp_path, mock_env_file, monkeypatch, capsys
|
|
72
|
-
):
|
|
73
|
-
mock_env_file.write_text("needkey_first=val1\n")
|
|
74
|
-
plugin_file = tmp_path / "needkey.py"
|
|
75
|
-
plugin_file.write_text(
|
|
76
|
-
"from flyshell.abstract.base_plugin import BasePlugin\n"
|
|
77
|
-
"class NeedKeyPlugin(BasePlugin):\n"
|
|
78
|
-
" api_keys = ['first', 'second']\n"
|
|
79
|
-
" def execute(self, args): return 0\n"
|
|
80
|
-
)
|
|
81
|
-
monkeypatch.setattr(c, "USER_PLUGIN_DIR", tmp_path)
|
|
82
|
-
loader.scan_plugins(plugin_folder=tmp_path)
|
|
83
|
-
out = capsys.readouterr().out
|
|
84
|
-
assert "API Key Error" in out
|
|
85
|
-
assert "second" in out
|
|
86
|
-
|
|
87
|
-
|
|
88
70
|
def test_directory_execute_fallback_when_keys_missing(
|
|
89
71
|
mock_env_file, monkeypatch, capsys
|
|
90
72
|
):
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# tests/test_security.py
|
|
2
|
-
|
|
3
|
-
from flyshell.builtin import system
|
|
4
|
-
from flyshell.accounts import auth
|
|
5
|
-
from flyshell.core import data
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def test_sysexe_blocks_prohibited_base_commands():
|
|
9
|
-
for cmd in ["format C:", "diskpart", "dd if=/dev/zero"]:
|
|
10
|
-
tokens = cmd.split()
|
|
11
|
-
code, message = system.SysExe().execute(tokens)
|
|
12
|
-
assert code == 1
|
|
13
|
-
assert "Security Error" in message
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
def test_sysexe_dangerous_commands_require_auth(monkeypatch):
|
|
17
|
-
dummy_hash, dummy_salt = auth.hash_password("ValidPassword123!")
|
|
18
|
-
monkeypatch.setattr(
|
|
19
|
-
data,
|
|
20
|
-
"get_auth",
|
|
21
|
-
lambda: {"username": "TestUser", "hash": dummy_hash, "salt": dummy_salt},
|
|
22
|
-
)
|
|
23
|
-
monkeypatch.setattr("getpass.getpass", lambda prompt="": "WrongPassword")
|
|
24
|
-
for cmd in ["del some_file.txt", "rm -rf some_dir"]:
|
|
25
|
-
tokens = cmd.split()
|
|
26
|
-
code, message = system.SysExe().execute(tokens)
|
|
27
|
-
assert code == 1
|
|
28
|
-
assert "Account Error" in message or "Password does not match" in message
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
def test_sysexe_force_flag_without_arguments_returns_error():
|
|
32
|
-
code, message = system.SysExe().execute(["-f"])
|
|
33
|
-
assert code == 1
|
|
34
|
-
assert "requires at least 1 parameter" in message
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
def test_sysexe_blocks_command_with_path_or_extension():
|
|
38
|
-
for cmd in ["/bin/dd if=/dev/zero", "diskpart.exe", "format.com"]:
|
|
39
|
-
tokens = cmd.split()
|
|
40
|
-
code, message = system.SysExe().execute(tokens)
|
|
41
|
-
assert code == 1
|
|
42
|
-
assert "Security Error" in message
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|