mirror of
https://github.com/rwinkhart/sshyp.git
synced 2026-09-05 16:47:14 -04:00
Apply consistent code formatting, especially regarding additive and multiplicative operators
This commit is contained in:
+2
-2
@@ -78,8 +78,8 @@ def remote_list_fetch(_user_data):
|
|||||||
_deletion_database = _remote_data[0].strip().splitlines()
|
_deletion_database = _remote_data[0].strip().splitlines()
|
||||||
_folder_database = _remote_data[1].strip().splitlines()
|
_folder_database = _remote_data[1].strip().splitlines()
|
||||||
_titles_mods = _remote_data[2].strip().splitlines()
|
_titles_mods = _remote_data[2].strip().splitlines()
|
||||||
return _deletion_database, _folder_database, _titles_mods[:len(_titles_mods)//2], \
|
return _deletion_database, _folder_database, _titles_mods[:len(_titles_mods) // 2], \
|
||||||
_titles_mods[len(_titles_mods)//2:]
|
_titles_mods[len(_titles_mods) // 2:]
|
||||||
|
|
||||||
|
|
||||||
# checks for and acts upon files and folders marked for deletion
|
# checks for and acts upon files and folders marked for deletion
|
||||||
|
|||||||
+60
-60
@@ -31,10 +31,10 @@ def entry_list_gen(_directory=f"{home}/.local/share/sshyp/"):
|
|||||||
else:
|
else:
|
||||||
_print_string = f"\u001b[38;5;8m{_filename[:-4]}\u001b[0m"
|
_print_string = f"\u001b[38;5;8m{_filename[:-4]}\u001b[0m"
|
||||||
# -3 instead of -4 to account for trailing space character
|
# -3 instead of -4 to account for trailing space character
|
||||||
_char_counter += len(_filename)-3
|
_char_counter += len(_filename) - 3
|
||||||
if _char_counter >= _width:
|
if _char_counter >= _width:
|
||||||
# reset _char_counter to length of first entry in new line
|
# reset _char_counter to length of first entry in new line
|
||||||
_char_counter = len(_filename)-3
|
_char_counter = len(_filename) - 3
|
||||||
print()
|
print()
|
||||||
print(_print_string + ' ', end='')
|
print(_print_string + ' ', end='')
|
||||||
_color_alternator = _color_alternator * -1
|
_color_alternator = _color_alternator * -1
|
||||||
@@ -82,7 +82,7 @@ def string_gen(_complexity, _length):
|
|||||||
if _complexity == 's':
|
if _complexity == 's':
|
||||||
_character_pool = string.ascii_letters + string.digits
|
_character_pool = string.ascii_letters + string.digits
|
||||||
elif _complexity == 'f':
|
elif _complexity == 'f':
|
||||||
_character_pool = string.digits + string.ascii_letters + string.punctuation.replace('/', '').replace('\\', '')\
|
_character_pool = string.digits + string.ascii_letters + string.punctuation.replace('/', '').replace('\\', '') \
|
||||||
.replace("'", '').replace('"', '').replace('`', '').replace('~', '')
|
.replace("'", '').replace('"', '').replace('`', '').replace('~', '')
|
||||||
else:
|
else:
|
||||||
_character_pool = string.digits + string.ascii_letters + string.punctuation
|
_character_pool = string.digits + string.ascii_letters + string.punctuation
|
||||||
@@ -201,7 +201,7 @@ def whitelist_verify(_port, _username_ssh, _ip, _client_device_id, _identity):
|
|||||||
from getpass import getpass
|
from getpass import getpass
|
||||||
_quick_unlock_password = getpass(prompt='\nquick-unlock pin: ')
|
_quick_unlock_password = getpass(prompt='\nquick-unlock pin: ')
|
||||||
_quick_unlock_password_excluded = \
|
_quick_unlock_password_excluded = \
|
||||||
run(('ssh', '-i', _identity, '-p', _port, f"{_username_ssh}@{_ip}",
|
run(('ssh', '-i', _identity, '-p', _port, f"{_username_ssh}@{_ip}",
|
||||||
f"gpg --pinentry-mode loopback --passphrase '{_quick_unlock_password}' "
|
f"gpg --pinentry-mode loopback --passphrase '{_quick_unlock_password}' "
|
||||||
f"-qd ~/.config/sshyp/excluded.gpg"), stdout=PIPE, text=True).stdout.rstrip()
|
f"-qd ~/.config/sshyp/excluded.gpg"), stdout=PIPE, text=True).stdout.rstrip()
|
||||||
while _i < len(_quick_unlock_password_excluded):
|
while _i < len(_quick_unlock_password_excluded):
|
||||||
@@ -287,20 +287,20 @@ def copy_id_check(_port, _username_ssh, _ip, _client_device_id, _identity, _sshy
|
|||||||
# prints help text based on argument
|
# prints help text based on argument
|
||||||
def print_info():
|
def print_info():
|
||||||
if arguments[0] in ('version', '-v'):
|
if arguments[0] in ('version', '-v'):
|
||||||
_blank = '\u001b[38;5;7;48;5;8m\\\u001b[38;5;15;48;5;15m' + 55*' ' + '\u001b[38;5;7;48;5;8m/\u001b[0m'
|
_blank = '\u001b[38;5;7;48;5;8m\\\u001b[38;5;15;48;5;15m' + 55 * ' ' + '\u001b[38;5;7;48;5;8m/\u001b[0m'
|
||||||
_border = '\u001b[38;5;7;48;5;8m' + 14*'<>' + '-' + 14*'<>' + '\u001b[0m\n'
|
_border = '\u001b[38;5;7;48;5;8m' + 14 * '<>' + '-' + 14 * '<>' + '\u001b[0m\n'
|
||||||
print(f"""\nsshyp is a simple, self-hosted, sftp-synchronized\npassword manager for unix(-like) systems\n
|
print(f"""\nsshyp is a simple, self-hosted, sftp-synchronized\npassword manager for unix(-like) systems\n
|
||||||
{9*' '}..{15*' '}\u001b[38;5;12m♥♥ \u001b[38;5;9m♥♥\u001b[0m{15*' '}..
|
{9 * ' '}..{15 * ' '}\u001b[38;5;12m♥♥ \u001b[38;5;9m♥♥\u001b[0m{15 * ' '}..
|
||||||
{8*' '}/()\\''.''.{7*' '}\u001b[38;5;12m♥♥♥\u001b[0m♥♥♥♥\u001b[0m{7*' '}.''.''/()\\{3*' '}_)
|
{8 * ' '}/()\\''.''.{7 * ' '}\u001b[38;5;12m♥♥♥\u001b[0m♥♥♥♥\u001b[0m{7 * ' '}.''.''/()\\{3 * ' '}_)
|
||||||
{5*' '}_.{3*' '}:{7*' '}*{7*' '}\u001b[38;5;9m♥♥♥♥♥\u001b[0m{7*' '}*{7*' '}:{3*' '}<[◎]|_|=
|
{5 * ' '}_.{3 * ' '}:{7 * ' '}*{7 * ' '}\u001b[38;5;9m♥♥♥♥♥\u001b[0m{7 * ' '}*{7 * ' '}:{3 * ' '}<[◎]|_|=
|
||||||
}}-}}-*]{4*' '}`..'..'{9*' '}\u001b[0m♥♥♥\u001b[0m{9*' '}`..'..'{6*' '}|
|
}}-}}-*]{4 * ' '}`..'..'{9 * ' '}\u001b[0m♥♥♥\u001b[0m{9 * ' '}`..'..'{6 * ' '}|
|
||||||
{4*' '}◎-◎{4*' '}//{3*' '}\\\\{10*' '}\u001b[38;5;9m♥\u001b[0m{10*' '}//{3*' '}\\\\{5*' '}/|\\""")
|
{4 * ' '}◎-◎{4 * ' '}//{3 * ' '}\\\\{10 * ' '}\u001b[38;5;9m♥\u001b[0m{10 * ' '}//{3 * ' '}\\\\{5 * ' '}/|\\""")
|
||||||
print(f"{_border}{_blank}\n\u001b[38;5;7;48;5;8m\\\u001b[38;5;15;48;5;15m{18*' '}\u001b[38;5;15;48;5;8msshyp "
|
print(f"{_border}{_blank}\n\u001b[38;5;7;48;5;8m\\\u001b[38;5;15;48;5;15m{18 * ' '}\u001b[38;5;15;48;5;8msshyp "
|
||||||
f"version 1.5.2\u001b[38;5;15;48;5;15m{18*' '}\u001b[38;5;7;48;5;8m/\u001b[0m")
|
f"version 1.5.2\u001b[38;5;15;48;5;15m{18 * ' '}\u001b[38;5;7;48;5;8m/\u001b[0m")
|
||||||
print(f"\u001b[38;5;7;48;5;8m\\\u001b[38;5;15;48;5;15m{14*' '}\u001b[38;5;15;48;5;8mthe fortified flock"
|
print(f"\u001b[38;5;7;48;5;8m\\\u001b[38;5;15;48;5;15m{14 * ' '}\u001b[38;5;15;48;5;8mthe fortified flock"
|
||||||
f" update\u001b[38;5;15;48;5;15m{15*' '}\u001b[38;5;7;48;5;8m/\u001b[0m\n{_blank}")
|
f" update\u001b[38;5;15;48;5;15m{15 * ' '}\u001b[38;5;7;48;5;8m/\u001b[0m\n{_blank}")
|
||||||
print(f"\u001b[38;5;7;48;5;8m\\\u001b[38;5;15;48;5;15m{9*' '}\u001b[38;5;15;48;5;8mcopyright 2021-2024 ",
|
print(f"\u001b[38;5;7;48;5;8m\\\u001b[38;5;15;48;5;15m{9 * ' '}\u001b[38;5;15;48;5;8mcopyright 2021-2024 ",
|
||||||
f"randall winkhart\u001b[38;5;15;48;5;15m{9*' '}\u001b[38;5;7;48;5;8m/\u001b[0m")
|
f"randall winkhart\u001b[38;5;15;48;5;15m{9 * ' '}\u001b[38;5;7;48;5;8m/\u001b[0m")
|
||||||
print(f"{_blank}\n{_border}\nsee https://github.com/rwinkhart/sshyp for more information\n")
|
print(f"{_blank}\n{_border}\nsee https://github.com/rwinkhart/sshyp for more information\n")
|
||||||
elif arguments[0] == 'license':
|
elif arguments[0] == 'license':
|
||||||
print('\nThis program is free software: you can redistribute it and/or modify it under the terms of\nversion 3 '
|
print('\nThis program is free software: you can redistribute it and/or modify it under the terms of\nversion 3 '
|
||||||
@@ -312,31 +312,31 @@ def print_info():
|
|||||||
print(f"""\n\u001b[1musage:\u001b[0m sshyp /<entry name> add <option>\u001b[0m\n
|
print(f"""\n\u001b[1musage:\u001b[0m sshyp /<entry name> add <option>\u001b[0m\n
|
||||||
\u001b[1moptions:\u001b[0m
|
\u001b[1moptions:\u001b[0m
|
||||||
add:
|
add:
|
||||||
password/-p{12*' '}add a password entry
|
password/-p{12 * ' '}add a password entry
|
||||||
note/-n{16*' '}add a note entry
|
note/-n{16 * ' '}add a note entry
|
||||||
folder/-f{14*' '}add a new folder for entries\n""")
|
folder/-f{14 * ' '}add a new folder for entries\n""")
|
||||||
elif arguments[0] == 'edit' and device_type == 'client':
|
elif arguments[0] == 'edit' and device_type == 'client':
|
||||||
print(f"""\n\u001b[1musage:\u001b[0m sshyp /<entry name> edit <option>\u001b[0m\n
|
print(f"""\n\u001b[1musage:\u001b[0m sshyp /<entry name> edit <option>\u001b[0m\n
|
||||||
\u001b[1moptions:\u001b[0m
|
\u001b[1moptions:\u001b[0m
|
||||||
edit:
|
edit:
|
||||||
rename/relocate/-r{5*' '}rename or relocate an entry
|
rename/relocate/-r{5 * ' '}rename or relocate an entry
|
||||||
username/-u{12*' '}change the username of an entry
|
username/-u{12 * ' '}change the username of an entry
|
||||||
password/-p{12*' '}change the password of an entry
|
password/-p{12 * ' '}change the password of an entry
|
||||||
url/-l{17*' '}change the url attached to an entry
|
url/-l{17 * ' '}change the url attached to an entry
|
||||||
note/-n{16*' '}change the note attached to an entry\n""")
|
note/-n{16 * ' '}change the note attached to an entry\n""")
|
||||||
elif arguments[0] == 'copy' and device_type == 'client':
|
elif arguments[0] == 'copy' and device_type == 'client':
|
||||||
print(f"""\n\u001b[1musage:\u001b[0m sshyp /<entry name> copy <option>\u001b[0m\n
|
print(f"""\n\u001b[1musage:\u001b[0m sshyp /<entry name> copy <option>\u001b[0m\n
|
||||||
\u001b[1moptions:\u001b[0m
|
\u001b[1moptions:\u001b[0m
|
||||||
copy:
|
copy:
|
||||||
username/-u{12*' '}copy the username of an entry to your clipboard
|
username/-u{12 * ' '}copy the username of an entry to your clipboard
|
||||||
password/-p{12*' '}copy the password of an entry to your clipboard
|
password/-p{12 * ' '}copy the password of an entry to your clipboard
|
||||||
url/-l{17*' '}copy the url of an entry to your clipboard
|
url/-l{17 * ' '}copy the url of an entry to your clipboard
|
||||||
note/-n{16*' '}copy the note of an entry to your clipboard\n""")
|
note/-n{16 * ' '}copy the note of an entry to your clipboard\n""")
|
||||||
elif arguments[0] == 'gen' and device_type == 'client':
|
elif arguments[0] == 'gen' and device_type == 'client':
|
||||||
print(f"""\n\u001b[1musage:\u001b[0m sshyp /<entry name> gen [option]\u001b[0m\n
|
print(f"""\n\u001b[1musage:\u001b[0m sshyp /<entry name> gen [option]\u001b[0m\n
|
||||||
\u001b[1moptions:\u001b[0m
|
\u001b[1moptions:\u001b[0m
|
||||||
gen:
|
gen:
|
||||||
update/-u{14*' '}generate a password for an existing entry\n""")
|
update/-u{14 * ' '}generate a password for an existing entry\n""")
|
||||||
else:
|
else:
|
||||||
print("\n\u001b[1msshyp ", "copyright (c) 2021-2024 ", """randall winkhart\u001b[0m
|
print("\n\u001b[1msshyp ", "copyright (c) 2021-2024 ", """randall winkhart\u001b[0m
|
||||||
this is free software, and you are welcome to redistribute it under certain conditions;
|
this is free software, and you are welcome to redistribute it under certain conditions;
|
||||||
@@ -344,44 +344,44 @@ this program comes with absolutely no warranty; type 'sshyp license' for details
|
|||||||
if device_type == 'client':
|
if device_type == 'client':
|
||||||
print(f"""\n\u001b[1musage:\u001b[0m sshyp [/<entry name> [argument] [option]] | [argument]\n
|
print(f"""\n\u001b[1musage:\u001b[0m sshyp [/<entry name> [argument] [option]] | [argument]\n
|
||||||
\u001b[1marguments:\u001b[0m
|
\u001b[1marguments:\u001b[0m
|
||||||
help/-h{17*' '}bring up this menu
|
help/-h{17 * ' '}bring up this menu
|
||||||
version/-v{14*' '}display sshyp version info
|
version/-v{14 * ' '}display sshyp version info
|
||||||
init{20*' '}set up sshyp
|
init{20 * ' '}set up sshyp
|
||||||
tweak{19*' '}change configuration options/manage extensions and updates
|
tweak{19 * ' '}change configuration options/manage extensions and updates
|
||||||
add{21*' '}add an entry
|
add{21 * ' '}add an entry
|
||||||
gen{21*' '}generate a new password
|
gen{21 * ' '}generate a new password
|
||||||
edit{20*' '}edit an existing entry
|
edit{20 * ' '}edit an existing entry
|
||||||
copy{20*' '}copy details of an entry to your clipboard
|
copy{20 * ' '}copy details of an entry to your clipboard
|
||||||
shear{19*' '}delete an existing entry
|
shear{19 * ' '}delete an existing entry
|
||||||
sync{20*' '}manually sync the entry directory via sshync
|
sync{20 * ' '}manually sync the entry directory via sshync
|
||||||
\n\u001b[1moptions:\u001b[0m
|
\n\u001b[1moptions:\u001b[0m
|
||||||
add:
|
add:
|
||||||
password/-p{12*' '}add a password entry
|
password/-p{12 * ' '}add a password entry
|
||||||
note/-n{16*' '}add a note entry
|
note/-n{16 * ' '}add a note entry
|
||||||
folder/-f{14*' '}add a new folder for entries
|
folder/-f{14 * ' '}add a new folder for entries
|
||||||
edit:
|
edit:
|
||||||
rename/relocate/-r{5*' '}rename or relocate an entry
|
rename/relocate/-r{5 * ' '}rename or relocate an entry
|
||||||
username/-u{12*' '}change the username of an entry
|
username/-u{12 * ' '}change the username of an entry
|
||||||
password/-p{12*' '}change the password of an entry
|
password/-p{12 * ' '}change the password of an entry
|
||||||
url/-l{17*' '}change the url attached to an entry
|
url/-l{17 * ' '}change the url attached to an entry
|
||||||
note/-n{16*' '}change the note attached to an entry
|
note/-n{16 * ' '}change the note attached to an entry
|
||||||
copy:
|
copy:
|
||||||
username/-u{12*' '}copy the username of an entry to your clipboard
|
username/-u{12 * ' '}copy the username of an entry to your clipboard
|
||||||
password/-p{12*' '}copy the password of an entry to your clipboard
|
password/-p{12 * ' '}copy the password of an entry to your clipboard
|
||||||
url/-l{17*' '}copy the url of an entry to your clipboard
|
url/-l{17 * ' '}copy the url of an entry to your clipboard
|
||||||
note/-n{16*' '}copy the note of an entry to your clipboard
|
note/-n{16 * ' '}copy the note of an entry to your clipboard
|
||||||
gen:
|
gen:
|
||||||
update/-u{14*' '}generate a password for an existing entry
|
update/-u{14 * ' '}generate a password for an existing entry
|
||||||
\n\u001b[1mtip 1:\u001b[0m you can quickly read an entry with 'sshyp /<entry name>'
|
\n\u001b[1mtip 1:\u001b[0m you can quickly read an entry with 'sshyp /<entry name>'
|
||||||
\u001b[1mtip 2:\u001b[0m type 'sshyp' to view a list of saved entries\n""")
|
\u001b[1mtip 2:\u001b[0m type 'sshyp' to view a list of saved entries\n""")
|
||||||
# PORT START HELP-SERVER
|
# PORT START HELP-SERVER
|
||||||
else:
|
else:
|
||||||
print(f"""\n\u001b[1musage:\u001b[0m sshyp <argument>\n
|
print(f"""\n\u001b[1musage:\u001b[0m sshyp <argument>\n
|
||||||
\u001b[1marguments:\u001b[0m
|
\u001b[1marguments:\u001b[0m
|
||||||
help/-h{17*' '}bring up this menu
|
help/-h{17 * ' '}bring up this menu
|
||||||
version/-v{14*' '}display sshyp version info
|
version/-v{14 * ' '}display sshyp version info
|
||||||
init{20*' '}set up sshyp
|
init{20 * ' '}set up sshyp
|
||||||
tweak{19*' '}change configuration options/manage extensions and updates\n""")
|
tweak{19 * ' '}change configuration options/manage extensions and updates\n""")
|
||||||
# PORT END HELP-SERVER
|
# PORT END HELP-SERVER
|
||||||
|
|
||||||
|
|
||||||
@@ -627,7 +627,7 @@ if __name__ == "__main__":
|
|||||||
arg_start = 1
|
arg_start = 1
|
||||||
entry_name = arguments[0].strip('/')
|
entry_name = arguments[0].strip('/')
|
||||||
# determine whether to show passwords in entry previews
|
# determine whether to show passwords in entry previews
|
||||||
if arg_count > 1 and arguments[arg_count-1] in ('--show', '-s'):
|
if arg_count > 1 and arguments[arg_count - 1] in ('--show', '-s'):
|
||||||
del arguments[-1]
|
del arguments[-1]
|
||||||
arg_count -= 1
|
arg_count -= 1
|
||||||
pass_show = True
|
pass_show = True
|
||||||
@@ -659,9 +659,9 @@ if __name__ == "__main__":
|
|||||||
if ssh_error:
|
if ssh_error:
|
||||||
ssh_error = copy_id_check(port, username_ssh, ip, client_device_id, identity, sshyp_data)
|
ssh_error = copy_id_check(port, username_ssh, ip, client_device_id, identity, sshyp_data)
|
||||||
except (FileNotFoundError, NoSectionError, NoOptionError):
|
except (FileNotFoundError, NoSectionError, NoOptionError):
|
||||||
print(f"\n{73*'!'}")
|
print(f"\n{73 * '!'}")
|
||||||
print("not all necessary configurations have been made - please run 'sshyp init'")
|
print("not all necessary configurations have been made - please run 'sshyp init'")
|
||||||
print(f"{73*'!'}\n")
|
print(f"{73 * '!'}\n")
|
||||||
s_exit(1)
|
s_exit(1)
|
||||||
else:
|
else:
|
||||||
from stweak import wrapped_entry
|
from stweak import wrapped_entry
|
||||||
|
|||||||
+13
-14
@@ -44,7 +44,7 @@ def curses_radio(_options, _pretext):
|
|||||||
# iterate through lines, splitting further (wrapping) as needed, to add to curses window
|
# iterate through lines, splitting further (wrapping) as needed, to add to curses window
|
||||||
_current_line = 0
|
_current_line = 0
|
||||||
for _line in _pretext_lines:
|
for _line in _pretext_lines:
|
||||||
if _current_line <= _height-4:
|
if _current_line <= _height - 4:
|
||||||
_button_gen = True
|
_button_gen = True
|
||||||
while len(_line) > _width:
|
while len(_line) > _width:
|
||||||
stdscr.addstr(_current_line, 0, _line[:_width])
|
stdscr.addstr(_current_line, 0, _line[:_width])
|
||||||
@@ -54,7 +54,7 @@ def curses_radio(_options, _pretext):
|
|||||||
_current_line += 1
|
_current_line += 1
|
||||||
else:
|
else:
|
||||||
_button_gen = False
|
_button_gen = False
|
||||||
stdscr.addstr(_current_line, 0, '# warning: re-size terminal to see more information'[:_width-1])
|
stdscr.addstr(_current_line, 0, '# warning: re-size terminal to see more information'[:_width - 1])
|
||||||
_current_line += 1
|
_current_line += 1
|
||||||
break
|
break
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ def curses_radio(_options, _pretext):
|
|||||||
else:
|
else:
|
||||||
stdscr.addstr(_y, 0, "[ ] " + _option)
|
stdscr.addstr(_y, 0, "[ ] " + _option)
|
||||||
else:
|
else:
|
||||||
stdscr.addstr(_y-1, 0, '# warning: re-size terminal to see more information')
|
stdscr.addstr(_y - 1, 0, '# warning: re-size terminal to see more information')
|
||||||
break
|
break
|
||||||
|
|
||||||
# update _selected based on user input
|
# update _selected based on user input
|
||||||
@@ -93,8 +93,8 @@ def curses_text(_pretext):
|
|||||||
stdscr.clear()
|
stdscr.clear()
|
||||||
stdscr.addstr(0, 0, _pretext)
|
stdscr.addstr(0, 0, _pretext)
|
||||||
_width = stdscr.getmaxyx()[1]
|
_width = stdscr.getmaxyx()[1]
|
||||||
_editwin = newwin(1, _width-2, 3, 1)
|
_editwin = newwin(1, _width - 2, 3, 1)
|
||||||
rectangle(stdscr, 2, 0, 4, _width-1)
|
rectangle(stdscr, 2, 0, 4, _width - 1)
|
||||||
stdscr.refresh()
|
stdscr.refresh()
|
||||||
_box = Textbox(_editwin)
|
_box = Textbox(_editwin)
|
||||||
# let the user edit until ctrl+g/enter is struck
|
# let the user edit until ctrl+g/enter is struck
|
||||||
@@ -139,7 +139,7 @@ def gpg_config():
|
|||||||
_named_uid_list.append(_uid.split(':')[9].replace('\\x3a', ':').replace('\\x5c', '\\'))
|
_named_uid_list.append(_uid.split(':')[9].replace('\\x3a', ':').replace('\\x5c', '\\'))
|
||||||
_named_uid_list.append('auto-generate')
|
_named_uid_list.append('auto-generate')
|
||||||
_gpg_id_sel = curses_radio(_named_uid_list, 'gpg key selection')
|
_gpg_id_sel = curses_radio(_named_uid_list, 'gpg key selection')
|
||||||
if _gpg_id_sel == len(_named_uid_list)-1:
|
if _gpg_id_sel == len(_named_uid_list) - 1:
|
||||||
if not isfile(f"{home}/.config/sshyp/gpg-gen"):
|
if not isfile(f"{home}/.config/sshyp/gpg-gen"):
|
||||||
open(f"{home}/.config/sshyp/gpg-gen", 'w').writelines([
|
open(f"{home}/.config/sshyp/gpg-gen", 'w').writelines([
|
||||||
'Key-Type: 1\n', 'Key-Length: 4096\n', 'Key-Usage: sign encrypt\n', 'Name-Real: sshyp\n',
|
'Key-Type: 1\n', 'Key-Length: 4096\n', 'Key-Usage: sign encrypt\n', 'Name-Real: sshyp\n',
|
||||||
@@ -205,9 +205,9 @@ def ssh_config(_reconfig=False):
|
|||||||
if _reconfig:
|
if _reconfig:
|
||||||
_keys.append('BACK')
|
_keys.append('BACK')
|
||||||
_key_selected_num = curses_radio(_keys, 'which private ssh key would you like to use for sshyp?')
|
_key_selected_num = curses_radio(_keys, 'which private ssh key would you like to use for sshyp?')
|
||||||
if _reconfig and _key_selected_num == len(_keys)-1:
|
if _reconfig and _key_selected_num == len(_keys) - 1:
|
||||||
return
|
return
|
||||||
_gen_index = len(_keys)-2
|
_gen_index = len(_keys) - 2
|
||||||
if _key_selected_num >= _gen_index:
|
if _key_selected_num >= _gen_index:
|
||||||
_ssh_key = expanduser(curses_text('enter the location for your private ssh key:\n\n\n\n\n(ctrl+g/enter to '
|
_ssh_key = expanduser(curses_text('enter the location for your private ssh key:\n\n\n\n\n(ctrl+g/enter to '
|
||||||
'confirm)\n\nexample input:\n\n~/.ssh/privkey'))
|
'confirm)\n\nexample input:\n\n~/.ssh/privkey'))
|
||||||
@@ -359,7 +359,7 @@ def registered_dev_id_remover(_back=False):
|
|||||||
# takes input from the user to set up quick-unlock pin
|
# takes input from the user to set up quick-unlock pin
|
||||||
def whitelist_setup():
|
def whitelist_setup():
|
||||||
_gpg_password_temp = str(curses_text('full gpg passphrase:\n\n\n\n\n(ctrl+g/enter to confirm)'))
|
_gpg_password_temp = str(curses_text('full gpg passphrase:\n\n\n\n\n(ctrl+g/enter to confirm)'))
|
||||||
_half_length = int(len(_gpg_password_temp)/2)
|
_half_length = int(len(_gpg_password_temp) / 2)
|
||||||
try:
|
try:
|
||||||
_short_password_length = int(curses_text(f"quick unlock pin length ({_half_length}):\n\n\n\n\n(ctrl+g/enter "
|
_short_password_length = int(curses_text(f"quick unlock pin length ({_half_length}):\n\n\n\n\n(ctrl+g/enter "
|
||||||
"to confirm)\n\npin must be half the length of the gpg passphrase "
|
"to confirm)\n\npin must be half the length of the gpg passphrase "
|
||||||
@@ -370,7 +370,7 @@ def whitelist_setup():
|
|||||||
_short_password_length = _half_length
|
_short_password_length = _half_length
|
||||||
_i, _quick_unlock_password, _quick_unlock_password_excluded = 0, '', ''
|
_i, _quick_unlock_password, _quick_unlock_password_excluded = 0, '', ''
|
||||||
for _char in _gpg_password_temp:
|
for _char in _gpg_password_temp:
|
||||||
if _i % 2 == 1 and _i < _short_password_length*2:
|
if _i % 2 == 1 and _i < _short_password_length * 2:
|
||||||
_quick_unlock_password += _char
|
_quick_unlock_password += _char
|
||||||
else:
|
else:
|
||||||
_quick_unlock_password_excluded += _char
|
_quick_unlock_password_excluded += _char
|
||||||
@@ -453,10 +453,10 @@ def extension_downloader():
|
|||||||
_extensions = _pointer.sections()
|
_extensions = _pointer.sections()
|
||||||
_extensions.append('BACK')
|
_extensions.append('BACK')
|
||||||
_choice = curses_radio(_extensions, 'select an extension for more info')
|
_choice = curses_radio(_extensions, 'select an extension for more info')
|
||||||
if _choice == len(_extensions)-1:
|
if _choice == len(_extensions) - 1:
|
||||||
return False
|
return False
|
||||||
_selected = _extensions[_choice]
|
_selected = _extensions[_choice]
|
||||||
_divider = (stdscr.getmaxyx()[1])*'-'
|
_divider = (stdscr.getmaxyx()[1]) * '-'
|
||||||
_choice = curses_radio(('no', 'yes'), '# description\n' + _divider + '\n\n' + _pointer.get(_selected, 'desc') +
|
_choice = curses_radio(('no', 'yes'), '# description\n' + _divider + '\n\n' + _pointer.get(_selected, 'desc') +
|
||||||
'\n\n# usage\n' + _divider + '\n\n' + _pointer.get(_selected, 'usage').replace('<br>', '\n')
|
'\n\n# usage\n' + _divider + '\n\n' + _pointer.get(_selected, 'usage').replace('<br>', '\n')
|
||||||
+ '\n\n' + _divider + '\n\ninstall ' + _selected + '?')
|
+ '\n\n' + _divider + '\n\ninstall ' + _selected + '?')
|
||||||
@@ -480,7 +480,7 @@ def extension_remover():
|
|||||||
_installed.append(_extension[:-4])
|
_installed.append(_extension[:-4])
|
||||||
_installed.append('BACK')
|
_installed.append('BACK')
|
||||||
_choice = curses_radio(_installed, 'select an extension to uninstall')
|
_choice = curses_radio(_installed, 'select an extension to uninstall')
|
||||||
if _choice == len(_installed)-1:
|
if _choice == len(_installed) - 1:
|
||||||
return False
|
return False
|
||||||
_sure = curses_radio(('no', 'yes'), f"are you sure you want to remove {_installed[_choice]}?")
|
_sure = curses_radio(('no', 'yes'), f"are you sure you want to remove {_installed[_choice]}?")
|
||||||
if _sure == 0:
|
if _sure == 0:
|
||||||
@@ -645,7 +645,6 @@ def initial_setup(_scr):
|
|||||||
|
|
||||||
# online (synchronized mode) configuration
|
# online (synchronized mode) configuration
|
||||||
if _dev_sync_types[1] != 'true':
|
if _dev_sync_types[1] != 'true':
|
||||||
|
|
||||||
# ssh+sshync configuration
|
# ssh+sshync configuration
|
||||||
_ip, _username_ssh, _port, _identity = ssh_config()
|
_ip, _username_ssh, _port, _identity = ssh_config()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user