flyshell 1.5.8__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.
Files changed (77) hide show
  1. {flyshell-1.5.8/src/flyshell.egg-info → flyshell-1.5.10}/PKG-INFO +1 -1
  2. {flyshell-1.5.8 → flyshell-1.5.10}/src/flyshell/builtin/fs.py +0 -10
  3. {flyshell-1.5.8 → flyshell-1.5.10}/src/flyshell/builtin/system.py +2 -41
  4. {flyshell-1.5.8 → flyshell-1.5.10}/src/flyshell/constants.py +3 -3
  5. {flyshell-1.5.8 → flyshell-1.5.10}/src/flyshell/core/data.py +20 -19
  6. {flyshell-1.5.8 → flyshell-1.5.10}/src/flyshell/main.py +1 -1
  7. {flyshell-1.5.8 → flyshell-1.5.10}/src/flyshell/startup/loader.py +0 -15
  8. {flyshell-1.5.8 → flyshell-1.5.10/src/flyshell.egg-info}/PKG-INFO +1 -1
  9. {flyshell-1.5.8 → flyshell-1.5.10}/src/flyshell.egg-info/SOURCES.txt +0 -1
  10. {flyshell-1.5.8 → flyshell-1.5.10}/tests/test_env.py +0 -18
  11. flyshell-1.5.8/tests/test_security.py +0 -42
  12. {flyshell-1.5.8 → flyshell-1.5.10}/LICENSE +0 -0
  13. {flyshell-1.5.8 → flyshell-1.5.10}/MANIFEST.in +0 -0
  14. {flyshell-1.5.8 → flyshell-1.5.10}/README.md +0 -0
  15. {flyshell-1.5.8 → flyshell-1.5.10}/c_src/diskops/diskops.c +0 -0
  16. {flyshell-1.5.8 → flyshell-1.5.10}/c_src/diskops/posix/cat.c +0 -0
  17. {flyshell-1.5.8 → flyshell-1.5.10}/c_src/diskops/posix/cp.c +0 -0
  18. {flyshell-1.5.8 → flyshell-1.5.10}/c_src/diskops/posix/dir.c +0 -0
  19. {flyshell-1.5.8 → flyshell-1.5.10}/c_src/diskops/posix/mkdir.c +0 -0
  20. {flyshell-1.5.8 → flyshell-1.5.10}/c_src/diskops/posix/mv.c +0 -0
  21. {flyshell-1.5.8 → flyshell-1.5.10}/c_src/diskops/posix/rename.c +0 -0
  22. {flyshell-1.5.8 → flyshell-1.5.10}/c_src/diskops/posix/rm.c +0 -0
  23. {flyshell-1.5.8 → flyshell-1.5.10}/c_src/diskops/posix/rmdir.c +0 -0
  24. {flyshell-1.5.8 → flyshell-1.5.10}/c_src/diskops/posix/touch.c +0 -0
  25. {flyshell-1.5.8 → flyshell-1.5.10}/c_src/diskops/shared/dir_types.c +0 -0
  26. {flyshell-1.5.8 → flyshell-1.5.10}/c_src/diskops/shared/dir_types.h +0 -0
  27. {flyshell-1.5.8 → flyshell-1.5.10}/c_src/diskops/shared/native_errors.h +0 -0
  28. {flyshell-1.5.8 → flyshell-1.5.10}/c_src/diskops/shared/win32_utf.h +0 -0
  29. {flyshell-1.5.8 → flyshell-1.5.10}/c_src/diskops/win32/cat.c +0 -0
  30. {flyshell-1.5.8 → flyshell-1.5.10}/c_src/diskops/win32/cp.c +0 -0
  31. {flyshell-1.5.8 → flyshell-1.5.10}/c_src/diskops/win32/dir.c +0 -0
  32. {flyshell-1.5.8 → flyshell-1.5.10}/c_src/diskops/win32/mkdir.c +0 -0
  33. {flyshell-1.5.8 → flyshell-1.5.10}/c_src/diskops/win32/mv.c +0 -0
  34. {flyshell-1.5.8 → flyshell-1.5.10}/c_src/diskops/win32/rename.c +0 -0
  35. {flyshell-1.5.8 → flyshell-1.5.10}/c_src/diskops/win32/rm.c +0 -0
  36. {flyshell-1.5.8 → flyshell-1.5.10}/c_src/diskops/win32/rmdir.c +0 -0
  37. {flyshell-1.5.8 → flyshell-1.5.10}/c_src/diskops/win32/touch.c +0 -0
  38. {flyshell-1.5.8 → flyshell-1.5.10}/pyproject.toml +0 -0
  39. {flyshell-1.5.8 → flyshell-1.5.10}/setup.cfg +0 -0
  40. {flyshell-1.5.8 → flyshell-1.5.10}/setup.py +0 -0
  41. {flyshell-1.5.8 → flyshell-1.5.10}/src/flyshell/__init__.py +0 -0
  42. {flyshell-1.5.8 → flyshell-1.5.10}/src/flyshell/abstract/__init__.py +0 -0
  43. {flyshell-1.5.8 → flyshell-1.5.10}/src/flyshell/abstract/base_cmd.py +0 -0
  44. {flyshell-1.5.8 → flyshell-1.5.10}/src/flyshell/abstract/base_plugin.py +0 -0
  45. {flyshell-1.5.8 → flyshell-1.5.10}/src/flyshell/abstract/parent_cmd.py +0 -0
  46. {flyshell-1.5.8 → flyshell-1.5.10}/src/flyshell/accounts/__init__.py +0 -0
  47. {flyshell-1.5.8 → flyshell-1.5.10}/src/flyshell/accounts/auth.py +0 -0
  48. {flyshell-1.5.8 → flyshell-1.5.10}/src/flyshell/bin/__init__.py +0 -0
  49. {flyshell-1.5.8 → flyshell-1.5.10}/src/flyshell/builtin/__init__.py +0 -0
  50. {flyshell-1.5.8 → flyshell-1.5.10}/src/flyshell/builtin/pkg.py +0 -0
  51. {flyshell-1.5.8 → flyshell-1.5.10}/src/flyshell/builtin/utils.py +0 -0
  52. {flyshell-1.5.8 → flyshell-1.5.10}/src/flyshell/core/__init__.py +0 -0
  53. {flyshell-1.5.8 → flyshell-1.5.10}/src/flyshell/core/console.py +0 -0
  54. {flyshell-1.5.8 → flyshell-1.5.10}/src/flyshell/core/directory.py +0 -0
  55. {flyshell-1.5.8 → flyshell-1.5.10}/src/flyshell/native/__init__.py +0 -0
  56. {flyshell-1.5.8 → flyshell-1.5.10}/src/flyshell/native/diskops_bridge.py +0 -0
  57. {flyshell-1.5.8 → flyshell-1.5.10}/src/flyshell/native/diskops_handler.py +0 -0
  58. {flyshell-1.5.8 → flyshell-1.5.10}/src/flyshell/native/legacy/__init__.py +0 -0
  59. {flyshell-1.5.8 → flyshell-1.5.10}/src/flyshell/native/legacy/diskops.py +0 -0
  60. {flyshell-1.5.8 → flyshell-1.5.10}/src/flyshell/startup/__init__.py +0 -0
  61. {flyshell-1.5.8 → flyshell-1.5.10}/src/flyshell/startup/deps.py +0 -0
  62. {flyshell-1.5.8 → flyshell-1.5.10}/src/flyshell/startup/env.py +0 -0
  63. {flyshell-1.5.8 → flyshell-1.5.10}/src/flyshell/startup/seasonal.py +0 -0
  64. {flyshell-1.5.8 → flyshell-1.5.10}/src/flyshell.egg-info/dependency_links.txt +0 -0
  65. {flyshell-1.5.8 → flyshell-1.5.10}/src/flyshell.egg-info/entry_points.txt +0 -0
  66. {flyshell-1.5.8 → flyshell-1.5.10}/src/flyshell.egg-info/requires.txt +0 -0
  67. {flyshell-1.5.8 → flyshell-1.5.10}/src/flyshell.egg-info/top_level.txt +0 -0
  68. {flyshell-1.5.8 → flyshell-1.5.10}/tests/test_auth.py +0 -0
  69. {flyshell-1.5.8 → flyshell-1.5.10}/tests/test_data.py +0 -0
  70. {flyshell-1.5.8 → flyshell-1.5.10}/tests/test_deps.py +0 -0
  71. {flyshell-1.5.8 → flyshell-1.5.10}/tests/test_directory.py +0 -0
  72. {flyshell-1.5.8 → flyshell-1.5.10}/tests/test_diskops_ext.py +0 -0
  73. {flyshell-1.5.8 → flyshell-1.5.10}/tests/test_diskops_lgc.py +0 -0
  74. {flyshell-1.5.8 → flyshell-1.5.10}/tests/test_fs.py +0 -0
  75. {flyshell-1.5.8 → flyshell-1.5.10}/tests/test_loader.py +0 -0
  76. {flyshell-1.5.8 → flyshell-1.5.10}/tests/test_pkg.py +0 -0
  77. {flyshell-1.5.8 → flyshell-1.5.10}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flyshell
3
- Version: 1.5.8
3
+ Version: 1.5.10
4
4
  Summary: A modular, zero-dependency command-line environment in Python.
5
5
  License-Expression: MIT
6
6
  Requires-Python: >=3.10
@@ -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
@@ -42,7 +39,7 @@ class OpenFile(BaseCmd):
42
39
  aliases = []
43
40
 
44
41
  def execute(self, args):
45
- target = " ".join(args).strip().strip("\"'")
42
+ target = " ".join(args).strip().strip('"')
46
43
  if not target:
47
44
  return (0, "")
48
45
  is_path = os.path.exists(target)
@@ -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(cmd_args)
77
+ raw_cmd = " ".join(args)
117
78
  result = subprocess.run(raw_cmd, shell=True)
118
79
  print()
119
80
  return (result.returncode, "")
@@ -5,9 +5,9 @@ import os
5
5
  import platform
6
6
  import time
7
7
 
8
- BUILD = 197
9
- VERFULL = "1.5.8d"
10
- VERSION = "1.5.8"
8
+ BUILD = 203
9
+ VERFULL = "1.5.10c"
10
+ VERSION = "1.5.10"
11
11
 
12
12
 
13
13
  def _resolve_app_dir() -> Path:
@@ -8,10 +8,11 @@ import sqlite3
8
8
  import time
9
9
 
10
10
 
11
- def get_storage_size() -> str:
12
- if not c.FILE_PATH.exists():
11
+ def get_storage_size(filename=None) -> str:
12
+ target = Path(filename) if filename is not None else c.FILE_PATH
13
+ if not target.exists():
13
14
  return "File not found"
14
- num_bytes = float(c.FILE_PATH.stat().st_size)
15
+ num_bytes = float(target.stat().st_size)
15
16
  for unit in ["B", "KB", "MB", "GB"]:
16
17
  if num_bytes < 1024.0:
17
18
  return (
@@ -84,7 +85,7 @@ def initialise(filename=None, initialised=None):
84
85
  initialised.add(target)
85
86
 
86
87
 
87
- def get_auth(filename=c.FILE_PATH) -> dict | None:
88
+ def get_auth(filename=None) -> dict | None:
88
89
  initialise(filename)
89
90
  with _get_connection(filename) as conn:
90
91
  row = conn.execute(
@@ -100,7 +101,7 @@ def get_auth(filename=c.FILE_PATH) -> dict | None:
100
101
  }
101
102
 
102
103
 
103
- def set_auth(username: str, pwd_hash: str, salt: str, filename=c.FILE_PATH) -> None:
104
+ def set_auth(username: str, pwd_hash: str, salt: str, filename=None) -> None:
104
105
  initialise(filename)
105
106
  now_utc = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())
106
107
  with _get_connection(filename) as conn:
@@ -114,7 +115,7 @@ def set_auth(username: str, pwd_hash: str, salt: str, filename=c.FILE_PATH) -> N
114
115
  )
115
116
 
116
117
 
117
- def clear_auth(filename=c.FILE_PATH) -> bool:
118
+ def clear_auth(filename=None) -> bool:
118
119
  initialise(filename)
119
120
  with _get_connection(filename) as conn:
120
121
  with conn:
@@ -122,7 +123,7 @@ def clear_auth(filename=c.FILE_PATH) -> bool:
122
123
  return cursor.rowcount > 0
123
124
 
124
125
 
125
- def append_history(cmd: str, timestamp: str, filename=c.FILE_PATH) -> None:
126
+ def append_history(cmd: str, timestamp: str, filename=None) -> None:
126
127
  initialise(filename)
127
128
  with _get_connection(filename) as conn:
128
129
  with conn:
@@ -132,7 +133,7 @@ def append_history(cmd: str, timestamp: str, filename=c.FILE_PATH) -> None:
132
133
  )
133
134
 
134
135
 
135
- def get_history(limit: int | None = None, filename=c.FILE_PATH) -> list[dict]:
136
+ def get_history(limit: int | None = None, filename=None) -> list[dict]:
136
137
  initialise(filename)
137
138
  with _get_connection(filename) as conn:
138
139
  if limit is not None and limit > 0:
@@ -147,7 +148,7 @@ def get_history(limit: int | None = None, filename=c.FILE_PATH) -> list[dict]:
147
148
  return [{"command": r[0], "timestamp": r[1]} for r in rows]
148
149
 
149
150
 
150
- def clear_history(filename=c.FILE_PATH) -> bool:
151
+ def clear_history(filename=None) -> bool:
151
152
  initialise(filename)
152
153
  with _get_connection(filename) as conn:
153
154
  with conn:
@@ -155,7 +156,7 @@ def clear_history(filename=c.FILE_PATH) -> bool:
155
156
  return True
156
157
 
157
158
 
158
- def get_config(key: str, default=None, filename=c.FILE_PATH):
159
+ def get_config(key: str, default=None, filename=None):
159
160
  initialise(filename)
160
161
  with _get_connection(filename) as conn:
161
162
  row = conn.execute(
@@ -169,7 +170,7 @@ def get_config(key: str, default=None, filename=c.FILE_PATH):
169
170
  return row[0]
170
171
 
171
172
 
172
- def set_config(key: str, value, filename=c.FILE_PATH) -> None:
173
+ def set_config(key: str, value, filename=None) -> None:
173
174
  initialise(filename)
174
175
  serialized = json.dumps(value)
175
176
  with _get_connection(filename) as conn:
@@ -183,7 +184,7 @@ def set_config(key: str, value, filename=c.FILE_PATH) -> None:
183
184
  )
184
185
 
185
186
 
186
- def delete_config(key: str, filename=c.FILE_PATH) -> bool:
187
+ def delete_config(key: str, filename=None) -> bool:
187
188
  initialise(filename)
188
189
  with _get_connection(filename) as conn:
189
190
  with conn:
@@ -191,7 +192,7 @@ def delete_config(key: str, filename=c.FILE_PATH) -> bool:
191
192
  return cursor.rowcount > 0
192
193
 
193
194
 
194
- def register_plugin(plugin_name: str, filename=c.FILE_PATH) -> None:
195
+ def register_plugin(plugin_name: str, filename=None) -> None:
195
196
  initialise(filename)
196
197
  now_utc = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())
197
198
  with _get_connection(filename) as conn:
@@ -205,7 +206,7 @@ def register_plugin(plugin_name: str, filename=c.FILE_PATH) -> None:
205
206
  )
206
207
 
207
208
 
208
- def get_plugin_data(plugin_name: str, key: str, default=None, filename=c.FILE_PATH):
209
+ def get_plugin_data(plugin_name: str, key: str, default=None, filename=None):
209
210
  initialise(filename)
210
211
  with _get_connection(filename) as conn:
211
212
  row = conn.execute(
@@ -222,7 +223,7 @@ def get_plugin_data(plugin_name: str, key: str, default=None, filename=c.FILE_PA
222
223
  return row[0]
223
224
 
224
225
 
225
- def set_plugin_data(plugin_name: str, key: str, value, filename=c.FILE_PATH) -> None:
226
+ def set_plugin_data(plugin_name: str, key: str, value, filename=None) -> None:
226
227
  initialise(filename)
227
228
  register_plugin(plugin_name, filename=filename)
228
229
  serialized = json.dumps(value)
@@ -237,7 +238,7 @@ def set_plugin_data(plugin_name: str, key: str, value, filename=c.FILE_PATH) ->
237
238
  )
238
239
 
239
240
 
240
- def get_all_plugin_data(plugin_name: str, filename=c.FILE_PATH) -> dict:
241
+ def get_all_plugin_data(plugin_name: str, filename=None) -> dict:
241
242
  initialise(filename)
242
243
  with _get_connection(filename) as conn:
243
244
  rows = conn.execute(
@@ -252,7 +253,7 @@ def get_all_plugin_data(plugin_name: str, filename=c.FILE_PATH) -> dict:
252
253
  return result
253
254
 
254
255
 
255
- def purge_plugin(plugin_name: str, filename=c.FILE_PATH) -> bool:
256
+ def purge_plugin(plugin_name: str, filename=None) -> bool:
256
257
  initialise(filename)
257
258
  with _get_connection(filename) as conn:
258
259
  with conn:
@@ -262,7 +263,7 @@ def purge_plugin(plugin_name: str, filename=c.FILE_PATH) -> bool:
262
263
  return cursor.rowcount > 0
263
264
 
264
265
 
265
- def purge_all_plugin_data(filename=c.FILE_PATH) -> bool:
266
+ def purge_all_plugin_data(filename=None) -> bool:
266
267
  initialise(filename)
267
268
  with _get_connection(filename) as conn:
268
269
  with conn:
@@ -271,7 +272,7 @@ def purge_all_plugin_data(filename=c.FILE_PATH) -> bool:
271
272
  return True
272
273
 
273
274
 
274
- def delete_plugin_data(plugin_name: str, key: str, filename=c.FILE_PATH) -> bool:
275
+ def delete_plugin_data(plugin_name: str, key: str, filename=None) -> bool:
275
276
  initialise(filename)
276
277
  with _get_connection(filename) as conn:
277
278
  with conn:
@@ -72,7 +72,7 @@ def main():
72
72
  from flyshell.core import console
73
73
  from flyshell.startup import loader
74
74
 
75
- if c.HOST_OS in ["Windows", "Darwin", "Linux"]:
75
+ if c.HOST_OS in c.SUPPORTED_OS:
76
76
  if sys.version_info < c.SUPPORTED_PYTHON:
77
77
  print(
78
78
  "\nCRITICAL ERROR: Your Python version is too old to be supported by Flyshell."
@@ -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
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flyshell
3
- Version: 1.5.8
3
+ Version: 1.5.10
4
4
  Summary: A modular, zero-dependency command-line environment in Python.
5
5
  License-Expression: MIT
6
6
  Requires-Python: >=3.10
@@ -71,5 +71,4 @@ tests/test_env.py
71
71
  tests/test_fs.py
72
72
  tests/test_loader.py
73
73
  tests/test_pkg.py
74
- tests/test_security.py
75
74
  tests/test_utils.py
@@ -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