From c7cae5303a66db693a1d2a7134e1995793d1a7c5 Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Tue, 4 Oct 2022 14:37:04 -0400 Subject: [PATCH] Add dedicated server help menu Former-commit-id: 36a139597b19d1c5ad9c08424723069d72221b11 [formerly c009dd63abf5004c9469b54990dcf71d2ae6c142] Former-commit-id: 46227a7c5aad5aff8ecfd8529bc53e433b3a57a8 --- bin/sshyp.py | 85 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 53 insertions(+), 32 deletions(-) diff --git a/bin/sshyp.py b/bin/sshyp.py index c53a8c1..f10cca9 100755 --- a/bin/sshyp.py +++ b/bin/sshyp.py @@ -301,37 +301,50 @@ def print_info(): # prints help text based on argument if argument_list[1] == 'help' or argument_list[1] == '--help' or argument_list[1] == '-h': print('\n\u001b[1msshyp copyright (c) 2021-2022 randall winkhart\u001b[0m\n') print("this is free software, and you are welcome to redistribute it under certain conditions;\nthis program " - "comes with absolutely no warranty;\ntype `sshyp license' for details") - print('\n\u001b[1musage:\u001b[0m sshyp [option [flag] []] | [/]\n') - print('\u001b[1moptions:\u001b[0m') - print('help/--help/-h bring up this menu') - print('version/-v display sshyp version info') - print('tweak configure sshyp') - print('add add an entry') - print('gen generate a new password') - print('edit edit an existing entry') - print('copy copy details of an entry to your clipboard') - print('shear/-rm delete an existing entry') - print('sync/-s manually sync the entry directory via sshync\n') - print('\u001b[1mflags:\u001b[0m') - print('add:') - print(' password/-p add a password entry') - print(' note/-n add a note entry') - print(' folder/-f add a new folder for entries') - print('edit:') - print(' rename/relocate/-r rename or relocate an entry') - print(' username/-u change the username of an entry') - print(' password/-p change the password of an entry') - print(' url/-l change the url attached to an entry') - print(' note/-n change the note attached to an entry') - print('copy:') - print(' username/-u copy the username of an entry to your clipboard') - print(' password/-p copy the password of an entry to your clipboard') - print(' url/-l copy the url of an entry to your clipboard') - print(' note/-n copy the note of an entry to your clipboard') - print('gen:') - print(' update/-u generate a password for an existing entry\n') - print("\u001b[1mtip:\u001b[0m you can quickly read an entry with 'sshyp /'") + "comes with absolutely no warranty;\ntype 'sshyp license' for details") + if device_type == 'c': + print('\n\u001b[1musage:\u001b[0m sshyp [option [flag] []] | [/]\n') + print('\u001b[1moptions:\u001b[0m') + print('help/--help/-h bring up this menu') + print('version/-v display sshyp version info') + print('tweak configure sshyp') + print('add add an entry') + print('gen generate a new password') + print('edit edit an existing entry') + print('copy copy details of an entry to your clipboard') + print('shear/-rm delete an existing entry') + print('sync/-s manually sync the entry directory via sshync\n') + print('\u001b[1mflags:\u001b[0m') + print('add:') + print(' password/-p add a password entry') + print(' note/-n add a note entry') + print(' folder/-f add a new folder for entries') + print('edit:') + print(' rename/relocate/-r rename or relocate an entry') + print(' username/-u change the username of an entry') + print(' password/-p change the password of an entry') + print(' url/-l change the url attached to an entry') + print(' note/-n change the note attached to an entry') + print('copy:') + print(' username/-u copy the username of an entry to your clipboard') + print(' password/-p copy the password of an entry to your clipboard') + print(' url/-l copy the url of an entry to your clipboard') + print(' note/-n copy the note of an entry to your clipboard') + print('gen:') + print(' update/-u generate a password for an existing entry') + print("\n\u001b[1mtip:\u001b[0m you can quickly read an entry with 'sshyp /'") + else: + print('\n\u001b[1musage:\u001b[0m sshyp [option [flag] []]\n') + print('\u001b[1moptions:\u001b[0m') + print('help/--help/-h bring up this menu') + print('version/-v display sshyp version info') + print('tweak configure sshyp') + print('whitelist manage the quick-unlock whitelist') + print('\u001b[1mflags:\u001b[0m') + print('whitelist:') + print(' list/-l view all registered device ids and their quick unlock whitelist status') + print(' add whitelist a device id for quick unlock') + print(' delete/del remove a device id from the quick unlock whitelist') elif argument_list[1] == 'version' or argument_list[1] == '-v': print('\nsshyp is a simple, self-hosted, sftp-synchronized password manager\nfor unix(-like) systems (haiku/' 'freebsd/linux/termux)\n\nsshyp is a viable alternative to (and compatible with) pass/password-store\n') @@ -384,6 +397,13 @@ def print_info(): # prints help text based on argument print(' password/-p copy the password of an entry to your clipboard') print(' url/-l copy the url of an entry to your clipboard') print(' note/-n copy the note of an entry to your clipboard\n') + elif argument_list[1] == 'whitelist' and device_type != 'c': + print('\n\u001b[1musage:\u001b[0m sshyp whitelist [flag []]\u001b[0m\n') + print('\u001b[1mflags:\u001b[0m') + print('whitelist:') + print(' list/-l view all registered device ids and their quick unlock whitelist status') + print(' add whitelist a device id for quick unlock') + print(' delete/del remove a device id from the quick unlock whitelist\n') def no_arg(): # displays a list of entries and gives an option to select one for viewing @@ -684,7 +704,8 @@ if __name__ == "__main__": if ssh_error != 0: ssh_error = copy_name_check(port, username_ssh, ip, client_device_name) elif argument_list[1] != "help" and argument_list[1] != "--help" and argument_list[1] != "-h" and \ - argument_list[1] != "license" and argument_list[1] != "version" and argument_list[1] != "-v": + argument_list[1] != "license" and argument_list[1] != "version" and argument_list[1] != "-v" \ + and argument_list[1] != "whitelist": print(f"\n\u001b[38;5;9merror: invalid server argument - run 'sshyp help' to " f"list usable commands\u001b[0m\n") s_exit(0)