mirror of
https://github.com/rwinkhart/sshyp.git
synced 2026-09-03 23:57:17 -04:00
Fixed privilege escalation code attempting to run when interacting with user-only menus
Former-commit-id: bcc2a99ab5324a049982bfff83eb191cfd7c0346 Former-commit-id: ce58e4b07a2e5fc26ab34c8ecdc695953b5a2d58
This commit is contained in:
+14
-12
@@ -512,7 +512,7 @@ def global_menu(_scr, _device_type, _top_message):
|
|||||||
_exit_signal = True
|
_exit_signal = True
|
||||||
if _exit_signal:
|
if _exit_signal:
|
||||||
break
|
break
|
||||||
return False, False, False
|
return None, None, None
|
||||||
|
|
||||||
|
|
||||||
# runs initial configuration wizard
|
# runs initial configuration wizard
|
||||||
@@ -582,16 +582,18 @@ def wrapped_entry(_gm_device_type, _gm_top_message='configuration options:'):
|
|||||||
_ext_name, _escalator, _action = \
|
_ext_name, _escalator, _action = \
|
||||||
wrapper(lambda _wrap_stdscr: (use_default_colors(),
|
wrapper(lambda _wrap_stdscr: (use_default_colors(),
|
||||||
global_menu(_wrap_stdscr, _gm_device_type, _gm_top_message)))[1]
|
global_menu(_wrap_stdscr, _gm_device_type, _gm_top_message)))[1]
|
||||||
if _action:
|
# only run if privilege escalation is needed
|
||||||
# install with privilege escalation (outside of curses)
|
if _action is not None:
|
||||||
from tempfile import gettempdir
|
if _action:
|
||||||
_exe_dir, _ini_dir = f"{gettempdir()}/sshyp_exe", f"{gettempdir()}/sshyp_ini"
|
# install with privilege escalation (outside of curses)
|
||||||
run((_escalator, 'chown', 'root:root', _exe_dir, _ini_dir))
|
from tempfile import gettempdir
|
||||||
run((_escalator, 'mv', _exe_dir, f"/usr/lib/sshyp/{_ext_name}"))
|
_exe_dir, _ini_dir = f"{gettempdir()}/sshyp_exe", f"{gettempdir()}/sshyp_ini"
|
||||||
run((_escalator, 'mv', _ini_dir, f"/usr/lib/sshyp/extensions/{_ext_name}.ini"))
|
run((_escalator, 'chown', 'root:root', _exe_dir, _ini_dir))
|
||||||
else:
|
run((_escalator, 'mv', _exe_dir, f"/usr/lib/sshyp/{_ext_name}"))
|
||||||
# uninstall with privilege escalation (outside of curses)
|
run((_escalator, 'mv', _ini_dir, f"/usr/lib/sshyp/extensions/{_ext_name}.ini"))
|
||||||
run((_escalator, 'rm', '-I', f"/usr/lib/sshyp/{_ext_name}",
|
else:
|
||||||
f"/usr/lib/sshyp/extensions/{_ext_name}.ini"))
|
# 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