mirror of
https://github.com/rwinkhart/sshyp.git
synced 2026-09-05 16:47:14 -04:00
Added error message for whitelist removal of a device ID that is not whitelisted
Former-commit-id: 10829a9d368351b97d5391cdf20712dd9e6bccef Former-commit-id: 1f3b47c9381ed7395654eaa9b918f0e38ae8024b
This commit is contained in:
+5
-3
@@ -531,8 +531,7 @@ def whitelist_list():
|
|||||||
|
|
||||||
|
|
||||||
# adds or removes quick-unlock whitelisted device ids
|
# adds or removes quick-unlock whitelisted device ids
|
||||||
def whitelist_manage():
|
def whitelist_manage(_device_id):
|
||||||
_device_id = arguments[2]
|
|
||||||
if arguments[1] == 'add':
|
if arguments[1] == 'add':
|
||||||
if _device_id in listdir(f"{home}/.config/sshyp/devices"):
|
if _device_id in listdir(f"{home}/.config/sshyp/devices"):
|
||||||
open(f"{home}/.config/sshyp/whitelist/{_device_id}", 'w').write('')
|
open(f"{home}/.config/sshyp/whitelist/{_device_id}", 'w').write('')
|
||||||
@@ -543,6 +542,9 @@ def whitelist_manage():
|
|||||||
elif isfile(f"{home}/.config/sshyp/whitelist/{_device_id}"):
|
elif isfile(f"{home}/.config/sshyp/whitelist/{_device_id}"):
|
||||||
remove(f"{home}/.config/sshyp/whitelist/{_device_id}")
|
remove(f"{home}/.config/sshyp/whitelist/{_device_id}")
|
||||||
whitelist_list()
|
whitelist_list()
|
||||||
|
else:
|
||||||
|
print(f"\n\u001b[38;5;9merror: device id ({_device_id}) is not whitelisted\u001b[0m\n")
|
||||||
|
s_exit(1)
|
||||||
# PORT END WHITELIST-SERVER
|
# PORT END WHITELIST-SERVER
|
||||||
|
|
||||||
|
|
||||||
@@ -912,7 +914,7 @@ if __name__ == "__main__":
|
|||||||
whitelist_setup()
|
whitelist_setup()
|
||||||
elif arg_count > 2 and arguments[1] in ('add', 'del'):
|
elif arg_count > 2 and arguments[1] in ('add', 'del'):
|
||||||
success_flag = True
|
success_flag = True
|
||||||
whitelist_manage()
|
whitelist_manage(arguments[2])
|
||||||
# PORT END ARGS-SERVER
|
# PORT END ARGS-SERVER
|
||||||
|
|
||||||
if arg_count > 0 and success_flag == 0 and arguments[0] != 'sync':
|
if arg_count > 0 and success_flag == 0 and arguments[0] != 'sync':
|
||||||
|
|||||||
Reference in New Issue
Block a user