mirror of
https://github.com/rwinkhart/sshyp.git
synced 2026-09-05 16:47:14 -04:00
Fixed privilege escalation input in extension manager
Former-commit-id: d75cdc8010eb8b5285c532284c9b14d553c7deaf Former-commit-id: 57edd15ca67e4f2e94f5201cdb18401b5ac40f59
This commit is contained in:
+16
-14
@@ -507,22 +507,12 @@ def global_menu(_scr, _device_type, _top_message):
|
|||||||
_ext_name, _escalator, _action = extension_menu()
|
_ext_name, _escalator, _action = extension_menu()
|
||||||
# if root is needed for extension management...
|
# if root is needed for extension management...
|
||||||
if _ext_name:
|
if _ext_name:
|
||||||
if _action:
|
return _ext_name, _escalator, _action
|
||||||
# install with privilege escalation (outside of curses)
|
|
||||||
from tempfile import gettempdir
|
|
||||||
_exe_dir, _ini_dir = f"{gettempdir()}/sshyp_exe", f"{gettempdir()}/sshyp_ini"
|
|
||||||
run((_escalator, 'chown', 'root:root', _exe_dir, _ini_dir))
|
|
||||||
run((_escalator, 'mv', _exe_dir, f"/usr/lib/sshyp/{_ext_name}"))
|
|
||||||
run((_escalator, 'mv', _ini_dir, f"/usr/lib/sshyp/extensions/{_ext_name}.ini"))
|
|
||||||
else:
|
|
||||||
# uninstall with privilege escalation (outside of curses)
|
|
||||||
run((_escalator, 'rm', '-I', f"/usr/lib/sshyp/{_ext_name}",
|
|
||||||
f"/usr/lib/sshyp/extensions/{_ext_name}.ini"))
|
|
||||||
break
|
|
||||||
else:
|
else:
|
||||||
_exit_signal = True
|
_exit_signal = True
|
||||||
if _exit_signal:
|
if _exit_signal:
|
||||||
break
|
break
|
||||||
|
return False, False, False
|
||||||
|
|
||||||
|
|
||||||
# runs initial configuration wizard
|
# runs initial configuration wizard
|
||||||
@@ -589,7 +579,19 @@ def wrapped_entry(_gm_device_type, _gm_top_message='configuration options:'):
|
|||||||
wrapper(lambda _wrap_stdscr: (use_default_colors(), initial_setup(_wrap_stdscr)))
|
wrapper(lambda _wrap_stdscr: (use_default_colors(), initial_setup(_wrap_stdscr)))
|
||||||
# any other value will be provided as the global menu device type
|
# any other value will be provided as the global menu device type
|
||||||
else:
|
else:
|
||||||
wrapper(lambda _wrap_stdscr: (use_default_colors(),
|
_ext_name, _escalator, _action = \
|
||||||
global_menu(_wrap_stdscr, _gm_device_type, _gm_top_message)))
|
wrapper(lambda _wrap_stdscr: (use_default_colors(),
|
||||||
|
global_menu(_wrap_stdscr, _gm_device_type, _gm_top_message)))[1]
|
||||||
|
if _action:
|
||||||
|
# install with privilege escalation (outside of curses)
|
||||||
|
from tempfile import gettempdir
|
||||||
|
_exe_dir, _ini_dir = f"{gettempdir()}/sshyp_exe", f"{gettempdir()}/sshyp_ini"
|
||||||
|
run((_escalator, 'chown', 'root:root', _exe_dir, _ini_dir))
|
||||||
|
run((_escalator, 'mv', _exe_dir, f"/usr/lib/sshyp/{_ext_name}"))
|
||||||
|
run((_escalator, 'mv', _ini_dir, f"/usr/lib/sshyp/extensions/{_ext_name}.ini"))
|
||||||
|
else:
|
||||||
|
# uninstall with privilege escalation (outside of curses)
|
||||||
|
run((_escalator, 'rm', '-I', f"/usr/lib/sshyp/{_ext_name}",
|
||||||
|
f"/usr/lib/sshyp/extensions/{_ext_name}.ini"))
|
||||||
for _message in term_messages:
|
for _message in term_messages:
|
||||||
print(f"\n{_message}\n")
|
print(f"\n{_message}\n")
|
||||||
|
|||||||
Reference in New Issue
Block a user