mirror of
https://github.com/rwinkhart/sshyp.git
synced 2026-09-05 08:37:14 -04:00
Added ability to pass entry names as arguments to most sshyp functions
This commit is contained in:
@@ -205,7 +205,7 @@ def print_info(): # prints help text based on argument
|
|||||||
print('/ /')
|
print('/ /')
|
||||||
print('/ sshyp Copyright (C) 2021-2022 Randall Winkhart /')
|
print('/ sshyp Copyright (C) 2021-2022 Randall Winkhart /')
|
||||||
print('/ /')
|
print('/ /')
|
||||||
print('/ Version 2022.03.02.fr5 /')
|
print('/ Version 2022.XX.XX.fr5 /')
|
||||||
print('/ The Polished Trotters Update /')
|
print('/ The Polished Trotters Update /')
|
||||||
print('/ /')
|
print('/ /')
|
||||||
print('////////////////////////////////////////////////////////\n')
|
print('////////////////////////////////////////////////////////\n')
|
||||||
@@ -216,15 +216,15 @@ def print_info(): # prints help text based on argument
|
|||||||
'useful, but WITHOUT ANY WARRANTY;\nwithout even the implied warranty of MERCHANTABILITY or FITNESS FOR A'
|
'useful, but WITHOUT ANY WARRANTY;\nwithout even the implied warranty of MERCHANTABILITY or FITNESS FOR A'
|
||||||
' PARTICULAR PURPOSE.\nSee the GNU General Public License for more details.'
|
' PARTICULAR PURPOSE.\nSee the GNU General Public License for more details.'
|
||||||
'\n\nhttps://opensource.org/licenses/GPL-3.0\n')
|
'\n\nhttps://opensource.org/licenses/GPL-3.0\n')
|
||||||
elif argument == 'add':
|
elif argument.startswith('add'):
|
||||||
print('\nUSAGE: sshyp add [FLAG]')
|
print('\nUSAGE: sshyp add [FLAG] <entry>')
|
||||||
print('Flags:')
|
print('Flags:')
|
||||||
print('add:')
|
print('add:')
|
||||||
print(' password/-p add a password entry')
|
print(' password/-p add a password entry')
|
||||||
print(' note/-n add a note entry')
|
print(' note/-n add a note entry')
|
||||||
print(' folder/-f add a new folder for entries\n')
|
print(' folder/-f add a new folder for entries\n')
|
||||||
elif argument == 'edit':
|
elif argument.startswith('edit'):
|
||||||
print('\nUSAGE: sshyp edit [FLAG]')
|
print('\nUSAGE: sshyp edit [FLAG] <entry>')
|
||||||
print('Flags:')
|
print('Flags:')
|
||||||
print('edit:')
|
print('edit:')
|
||||||
print(' rename/relocate/-r rename or relocate an entry')
|
print(' rename/relocate/-r rename or relocate an entry')
|
||||||
@@ -232,8 +232,8 @@ def print_info(): # prints help text based on argument
|
|||||||
print(' password/-p change the password of an entry')
|
print(' password/-p change the password of an entry')
|
||||||
print(' url/-l change the url attached to an entry')
|
print(' url/-l change the url attached to an entry')
|
||||||
print(' note/-n change the note attached to an entry\n')
|
print(' note/-n change the note attached to an entry\n')
|
||||||
elif argument == 'copy':
|
elif argument.startswith('copy'):
|
||||||
print('\nUSAGE: sshyp copy [FLAG]')
|
print('\nUSAGE: sshyp copy [FLAG] <entry>')
|
||||||
print('Flags:')
|
print('Flags:')
|
||||||
print('copy:')
|
print('copy:')
|
||||||
print(' username/-u copy the username of an entry to your clipboard')
|
print(' username/-u copy the username of an entry to your clipboard')
|
||||||
@@ -305,15 +305,20 @@ def sync(): # calls sshync to sync changes to the user's server
|
|||||||
|
|
||||||
def add_entry(): # adds a new entry
|
def add_entry(): # adds a new entry
|
||||||
_shm_folder, _shm_entry = None, None # sets base-line values to avoid errors
|
_shm_folder, _shm_entry = None, None # sets base-line values to avoid errors
|
||||||
_entry_name = str(input('\nName of entry: '))
|
if argument == 'add note' or argument == 'add -n' or argument == 'add password' or argument == 'add -p':
|
||||||
|
_entry_name = str(input('\nName of entry: '))
|
||||||
|
else:
|
||||||
|
_entry_name = argument.split(' ')
|
||||||
|
del _entry_name[:2]
|
||||||
|
_entry_name = ' '.join(_entry_name)
|
||||||
if _entry_name.startswith('/'):
|
if _entry_name.startswith('/'):
|
||||||
_entry_name = _entry_name.replace('/', '', 1)
|
_entry_name = _entry_name.replace('/', '', 1)
|
||||||
if argument == 'add note' or argument == 'add -n':
|
if argument.startswith('add note') or argument.startswith('add -n'):
|
||||||
_shm_folder, _shm_entry = shm_gen()
|
_shm_folder, _shm_entry = shm_gen()
|
||||||
system(f"nano {tmp_dir}{_shm_folder}/{_shm_entry}-n")
|
system(f"nano {tmp_dir}{_shm_folder}/{_shm_entry}-n")
|
||||||
_notes = open(f"{tmp_dir}{_shm_folder}/{_shm_entry}-n", 'r').read()
|
_notes = open(f"{tmp_dir}{_shm_folder}/{_shm_entry}-n", 'r').read()
|
||||||
open(f"{tmp_dir}{_shm_folder}/{_shm_entry}", 'w').writelines('\n\n\n\n' + _notes + '\n\n')
|
open(f"{tmp_dir}{_shm_folder}/{_shm_entry}", 'w').writelines('\n\n\n\n' + _notes + '\n\n')
|
||||||
elif argument == 'add password' or argument == 'add -p':
|
elif argument.startswith('add password') or argument.startswith('add -p'):
|
||||||
_username = str(input('Username: '))
|
_username = str(input('Username: '))
|
||||||
_password = str(input('Password: '))
|
_password = str(input('Password: '))
|
||||||
_url = str(input('URL: '))
|
_url = str(input('URL: '))
|
||||||
@@ -331,15 +336,27 @@ def add_entry(): # adds a new entry
|
|||||||
|
|
||||||
|
|
||||||
def add_folder(): # creates a new folder
|
def add_folder(): # creates a new folder
|
||||||
_folder_name = str(input('Name of new folder: '))
|
if argument == 'add folder' or argument == 'add -f':
|
||||||
|
_folder_name = str(input('Name of new folder: '))
|
||||||
|
else:
|
||||||
|
_folder_name = argument.split(' ')
|
||||||
|
del _folder_name[:2]
|
||||||
|
_folder_name = ' '.join(_folder_name)
|
||||||
|
if _folder_name.startswith('/'):
|
||||||
|
_folder_name = _folder_name.replace('/', '', 1)
|
||||||
Path(directory + _folder_name).mkdir(0o700)
|
Path(directory + _folder_name).mkdir(0o700)
|
||||||
system(f"ssh -i '{path.expanduser('~/.ssh/sshyp')}' -p {port} {username_ssh}@{ip} \"mkdir -p '{directory_ssh}"
|
system(f"ssh -i '{path.expanduser('~/.ssh/sshyp')}' -p {port} {username_ssh}@{ip} \"mkdir -p '{directory_ssh}"
|
||||||
f"{_folder_name}'\"")
|
f"{_folder_name}'\"")
|
||||||
|
|
||||||
|
|
||||||
def rename(): # renames an entry or folder TODO delete original from server to prevent re-downloading
|
def rename(): # renames an entry or folder TODO delete original from server to prevent re-downloading
|
||||||
entry_list_gen()
|
if argument == 'edit rename' or argument == 'edit relocate' or argument == 'edit -r':
|
||||||
_entry_name = str(input('What would you like to rename/relocate? '))
|
entry_list_gen()
|
||||||
|
_entry_name = str(input('What would you like to rename/relocate? '))
|
||||||
|
else:
|
||||||
|
_entry_name = argument.split(' ')
|
||||||
|
del _entry_name[:2]
|
||||||
|
_entry_name = ' '.join(_entry_name)
|
||||||
_new_name = str(input('New Name: '))
|
_new_name = str(input('New Name: '))
|
||||||
if _entry_name.startswith('/'):
|
if _entry_name.startswith('/'):
|
||||||
if _entry_name.replace('/', '', 1).__contains__('/'):
|
if _entry_name.replace('/', '', 1).__contains__('/'):
|
||||||
@@ -353,29 +370,35 @@ def rename(): # renames an entry or folder TODO delete original from server to
|
|||||||
|
|
||||||
def edit(): # edits the contents of an entry
|
def edit(): # edits the contents of an entry
|
||||||
_shm_folder, _shm_entry = None, None # sets base-line values to avoid errors
|
_shm_folder, _shm_entry = None, None # sets base-line values to avoid errors
|
||||||
entry_list_gen()
|
if argument == 'edit username' or argument == 'edit -u' or argument == 'edit password' or argument == 'edit -p' or \
|
||||||
_entry_name = str(input('What file would you like to edit? '))
|
argument == 'edit url' or argument == 'edit -l' or argument == 'edit note' or argument == 'edit -n':
|
||||||
|
entry_list_gen()
|
||||||
|
_entry_name = str(input('What file would you like to edit? '))
|
||||||
|
else:
|
||||||
|
_entry_name = argument.split(' ')
|
||||||
|
del _entry_name[:2]
|
||||||
|
_entry_name = ' '.join(_entry_name)
|
||||||
|
if _entry_name.startswith('/'):
|
||||||
|
_entry_name = _entry_name.replace('/', '', 1)
|
||||||
if not Path(f"{directory}{_entry_name}.gpg").is_file():
|
if not Path(f"{directory}{_entry_name}.gpg").is_file():
|
||||||
print("\nYou are trying to edit a file that does not exist!\n")
|
print("\nYou are trying to edit a file that does not exist!\n")
|
||||||
s_exit()
|
s_exit()
|
||||||
if _entry_name.startswith('/'):
|
if argument.startswith('edit username') or argument.startswith('edit -u'):
|
||||||
_entry_name = _entry_name.replace('/', '', 1)
|
|
||||||
if argument == 'edit username' or argument == 'edit -u':
|
|
||||||
_detail = str(input('New Username: '))
|
_detail = str(input('New Username: '))
|
||||||
_shm_folder, _shm_entry = shm_gen()
|
_shm_folder, _shm_entry = shm_gen()
|
||||||
system(f"gpg -d --output {tmp_dir}{_shm_folder}/{_shm_entry} '{directory}{_entry_name}.gpg'")
|
system(f"gpg -d --output {tmp_dir}{_shm_folder}/{_shm_entry} '{directory}{_entry_name}.gpg'")
|
||||||
replace_line(f"{tmp_dir}{_shm_folder}/{_shm_entry}", 0, _detail + '\n')
|
replace_line(f"{tmp_dir}{_shm_folder}/{_shm_entry}", 0, _detail + '\n')
|
||||||
elif argument == 'edit password' or argument == 'edit -p':
|
elif argument.startswith('edit password') or argument.startswith('edit -p'):
|
||||||
_detail = str(input('New Password: '))
|
_detail = str(input('New Password: '))
|
||||||
_shm_folder, _shm_entry = shm_gen()
|
_shm_folder, _shm_entry = shm_gen()
|
||||||
system(f"gpg -d --output {tmp_dir}{_shm_folder}/{_shm_entry} '{directory}{_entry_name}.gpg'")
|
system(f"gpg -d --output {tmp_dir}{_shm_folder}/{_shm_entry} '{directory}{_entry_name}.gpg'")
|
||||||
replace_line(f"{tmp_dir}{_shm_folder}/{_shm_entry}", 1, _detail + '\n')
|
replace_line(f"{tmp_dir}{_shm_folder}/{_shm_entry}", 1, _detail + '\n')
|
||||||
elif argument == 'edit url' or argument == 'edit -l':
|
elif argument.startswith('edit url') or argument.startswith('edit -l'):
|
||||||
_detail = str(input('New URL: '))
|
_detail = str(input('New URL: '))
|
||||||
_shm_folder, _shm_entry = shm_gen()
|
_shm_folder, _shm_entry = shm_gen()
|
||||||
system(f"gpg -d --output {tmp_dir}{_shm_folder}/{_shm_entry} '{directory}{_entry_name}.gpg'")
|
system(f"gpg -d --output {tmp_dir}{_shm_folder}/{_shm_entry} '{directory}{_entry_name}.gpg'")
|
||||||
replace_line(f"{tmp_dir}{_shm_folder}/{_shm_entry}", 2, _detail + '\n')
|
replace_line(f"{tmp_dir}{_shm_folder}/{_shm_entry}", 2, _detail + '\n')
|
||||||
elif argument == 'edit note' or argument == 'edit -n':
|
elif argument.startswith('edit note') or argument.startswith('edit -n'):
|
||||||
_shm_folder, _shm_entry = shm_gen()
|
_shm_folder, _shm_entry = shm_gen()
|
||||||
system(f"gpg -d --output {tmp_dir}{_shm_folder}/{_shm_entry} '{directory}{_entry_name}.gpg'")
|
system(f"gpg -d --output {tmp_dir}{_shm_folder}/{_shm_entry} '{directory}{_entry_name}.gpg'")
|
||||||
edit_note(_shm_folder, _shm_entry)
|
edit_note(_shm_folder, _shm_entry)
|
||||||
@@ -386,18 +409,27 @@ def edit(): # edits the contents of an entry
|
|||||||
|
|
||||||
def gen(): # generates a password for a new or an existing entry
|
def gen(): # generates a password for a new or an existing entry
|
||||||
_username, _url, _notes = None, None, None # sets base-line values to avoid errors
|
_username, _url, _notes = None, None, None # sets base-line values to avoid errors
|
||||||
if argument == 'gen update' or argument == 'gen -u':
|
if argument == 'gen update' or argument == 'gen -u' or argument == 'gen':
|
||||||
entry_list_gen()
|
if argument == 'gen update' or argument == 'gen -u':
|
||||||
|
entry_list_gen()
|
||||||
|
else:
|
||||||
|
print()
|
||||||
|
_entry_name = str(input('Name of service: '))
|
||||||
|
elif argument.startswith('gen update') or argument.startswith('gen -u'):
|
||||||
|
_entry_name = argument.split(' ')
|
||||||
|
del _entry_name[:2]
|
||||||
|
_entry_name = ' '.join(_entry_name)
|
||||||
else:
|
else:
|
||||||
print()
|
_entry_name = argument.split(' ')
|
||||||
_entry_name = str(input('Name of service: '))
|
del _entry_name[:1]
|
||||||
|
_entry_name = ' '.join(_entry_name)
|
||||||
if _entry_name.startswith('/'):
|
if _entry_name.startswith('/'):
|
||||||
_entry_name = _entry_name.replace('/', '', 1)
|
_entry_name = _entry_name.replace('/', '', 1)
|
||||||
if argument == 'gen update' or argument == 'gen -u':
|
if argument.startswith('gen update') or argument.startswith('gen -u'):
|
||||||
if not Path(f"{directory}{_entry_name}.gpg").is_file():
|
if not Path(f"{directory}{_entry_name}.gpg").is_file():
|
||||||
print("\nYou are trying to edit a file that does not exist!\n")
|
print("\nYou are trying to edit a file that does not exist!\n")
|
||||||
s_exit()
|
s_exit()
|
||||||
if argument != 'gen update' and argument != 'gen -u':
|
else:
|
||||||
_username = str(input('Username: '))
|
_username = str(input('Username: '))
|
||||||
_pass_length = int(input('How many characters should be in the password? '))
|
_pass_length = int(input('How many characters should be in the password? '))
|
||||||
_pass_type = str(input('Should the password be simple (for compatibility) or complex (for security)? (s/C) '))
|
_pass_type = str(input('Should the password be simple (for compatibility) or complex (for security)? (s/C) '))
|
||||||
@@ -406,7 +438,7 @@ def gen(): # generates a password for a new or an existing entry
|
|||||||
else:
|
else:
|
||||||
_pass_type = string.ascii_letters + string.digits + string.punctuation
|
_pass_type = string.ascii_letters + string.digits + string.punctuation
|
||||||
_pass_gen = ''.join(random.SystemRandom().choice(_pass_type) for _ in range(_pass_length))
|
_pass_gen = ''.join(random.SystemRandom().choice(_pass_type) for _ in range(_pass_length))
|
||||||
if argument != 'gen update' and argument != 'gen -u':
|
if not argument.startswith('gen update') and not argument.startswith('gen -u'):
|
||||||
_url = str(input('URL: '))
|
_url = str(input('URL: '))
|
||||||
_add_note = input('Add a note to this entry? (y/N) ')
|
_add_note = input('Add a note to this entry? (y/N) ')
|
||||||
_shm_folder, _shm_entry = shm_gen()
|
_shm_folder, _shm_entry = shm_gen()
|
||||||
@@ -429,8 +461,14 @@ def gen(): # generates a password for a new or an existing entry
|
|||||||
|
|
||||||
|
|
||||||
def copy_data(): # copies a specified field of an entry to the clipboard
|
def copy_data(): # copies a specified field of an entry to the clipboard
|
||||||
entry_list_gen()
|
if argument == 'copy username' or argument == 'copy -u' or argument == 'copy password' or argument == 'copy -p' \
|
||||||
_read_entry = str(input('Entry to copy: '))
|
or argument == 'copy url' or argument == 'copy -l' or argument == 'copy note' or argument == 'copy -n':
|
||||||
|
entry_list_gen()
|
||||||
|
_read_entry = str(input('Entry to copy: '))
|
||||||
|
else:
|
||||||
|
_read_entry = argument.split(' ')
|
||||||
|
del _read_entry[:2]
|
||||||
|
_read_entry = ' '.join(_read_entry)
|
||||||
if not Path(f"{directory}{_read_entry}.gpg").is_file():
|
if not Path(f"{directory}{_read_entry}.gpg").is_file():
|
||||||
print("\nThe file does not exist!\n")
|
print("\nThe file does not exist!\n")
|
||||||
s_exit()
|
s_exit()
|
||||||
@@ -438,38 +476,43 @@ def copy_data(): # copies a specified field of an entry to the clipboard
|
|||||||
system(f"gpg -d --output {tmp_dir}{_shm_folder}/{_shm_entry} '{directory}{_read_entry}.gpg'")
|
system(f"gpg -d --output {tmp_dir}{_shm_folder}/{_shm_entry} '{directory}{_read_entry}.gpg'")
|
||||||
_copy_line = open(f"{tmp_dir}{_shm_folder}/{_shm_entry}", 'r').readlines()
|
_copy_line = open(f"{tmp_dir}{_shm_folder}/{_shm_entry}", 'r').readlines()
|
||||||
if Path("/data/data/com.termux").exists(): # checks for Termux, Wayland, or X
|
if Path("/data/data/com.termux").exists(): # checks for Termux, Wayland, or X
|
||||||
if argument == 'copy username' or argument == 'copy -u':
|
if argument.startswith('copy username') or argument.startswith('copy -u'):
|
||||||
system('termux-clipboard-set ' + "'" + _copy_line[0].replace('\n', '').replace("'", "'\\''") + "'")
|
system('termux-clipboard-set ' + "'" + _copy_line[0].replace('\n', '').replace("'", "'\\''") + "'")
|
||||||
elif argument == 'copy password' or argument == 'copy -p':
|
elif argument.startswith('copy password') or argument.startswith('copy -p'):
|
||||||
system('termux-clipboard-set ' + "'" + _copy_line[1].replace('\n', '').replace("'", "'\\''") + "'")
|
system('termux-clipboard-set ' + "'" + _copy_line[1].replace('\n', '').replace("'", "'\\''") + "'")
|
||||||
elif argument == 'copy url' or argument == 'copy -l':
|
elif argument.startswith('copy url') or argument.startswith('copy -l'):
|
||||||
system('termux-clipboard-set ' + "'" + _copy_line[2].replace('\n', '').replace("'", "'\\''") + "'")
|
system('termux-clipboard-set ' + "'" + _copy_line[2].replace('\n', '').replace("'", "'\\''") + "'")
|
||||||
elif argument == 'copy note' or argument == 'copy -n':
|
elif argument.startswith('copy note') or argument.startswith('copy -n'):
|
||||||
system('termux-clipboard-set ' + "'" + _copy_line[4].replace('\n', '').replace("'", "'\\''") + "'")
|
system('termux-clipboard-set ' + "'" + _copy_line[4].replace('\n', '').replace("'", "'\\''") + "'")
|
||||||
elif environ.get('WAYLAND_DISPLAY') == 'wayland-0':
|
elif environ.get('WAYLAND_DISPLAY') == 'wayland-0':
|
||||||
if argument == 'copy username' or argument == 'copy -u':
|
if argument.startswith('copy username') or argument.startswith('copy -u'):
|
||||||
system('wl-copy ' + "'" + _copy_line[0].replace('\n', '').replace("'", "'\\''") + "'")
|
system('wl-copy ' + "'" + _copy_line[0].replace('\n', '').replace("'", "'\\''") + "'")
|
||||||
elif argument == 'copy password' or argument == 'copy -p':
|
elif argument.startswith('copy password') or argument.startswith('copy -p'):
|
||||||
system('wl-copy ' + "'" + _copy_line[1].replace('\n', '').replace("'", "'\\''") + "'")
|
system('wl-copy ' + "'" + _copy_line[1].replace('\n', '').replace("'", "'\\''") + "'")
|
||||||
elif argument == 'copy url' or argument == 'copy -l':
|
elif argument.startswith('copy url') or argument.startswith('copy -l'):
|
||||||
system('wl-copy ' + "'" + _copy_line[2].replace('\n', '').replace("'", "'\\''") + "'")
|
system('wl-copy ' + "'" + _copy_line[2].replace('\n', '').replace("'", "'\\''") + "'")
|
||||||
elif argument == 'copy note' or argument == 'copy -n':
|
elif argument.startswith('copy note') or argument.startswith('copy -n'):
|
||||||
system('wl-copy ' + "'" + _copy_line[4].replace('\n', '').replace("'", "'\\''") + "'")
|
system('wl-copy ' + "'" + _copy_line[4].replace('\n', '').replace("'", "'\\''") + "'")
|
||||||
else:
|
else:
|
||||||
if argument == 'copy username' or argument == 'copy -u':
|
if argument.startswith('copy username') or argument.startswith('copy -u'):
|
||||||
system('echo -n ' + "'" + _copy_line[0].replace('\n', '').replace("'", "'\\''") + "'" + ' | xclip -sel c')
|
system('echo -n ' + "'" + _copy_line[0].replace('\n', '').replace("'", "'\\''") + "'" + ' | xclip -sel c')
|
||||||
elif argument == 'copy password' or argument == 'copy -p':
|
elif argument.startswith('copy password') or argument.startswith('copy -p'):
|
||||||
system('echo -n ' + "'" + _copy_line[1].replace('\n', '').replace("'", "'\\''") + "'" + ' | xclip -sel c')
|
system('echo -n ' + "'" + _copy_line[1].replace('\n', '').replace("'", "'\\''") + "'" + ' | xclip -sel c')
|
||||||
elif argument == 'copy url' or argument == 'copy -l':
|
elif argument.startswith('copy url') or argument.startswith('copy -l'):
|
||||||
system('echo -n ' + "'" + _copy_line[2].replace('\n', '').replace("'", "'\\''") + "'" + ' | xclip -sel c')
|
system('echo -n ' + "'" + _copy_line[2].replace('\n', '').replace("'", "'\\''") + "'" + ' | xclip -sel c')
|
||||||
elif argument == 'copy note' or argument == 'copy -n':
|
elif argument.startswith('copy note') or argument.startswith('copy -n'):
|
||||||
system('echo -n ' + "'" + _copy_line[4].replace('\n', '').replace("'", "'\\''") + "'" + ' | xclip -sel c')
|
system('echo -n ' + "'" + _copy_line[4].replace('\n', '').replace("'", "'\\''") + "'" + ' | xclip -sel c')
|
||||||
rmtree(f"{tmp_dir}{_shm_folder}")
|
rmtree(f"{tmp_dir}{_shm_folder}")
|
||||||
|
|
||||||
|
|
||||||
def remove_data(): # deletes an entry from the server and flags it for local deletion on sync
|
def remove_data(): # deletes an entry from the server and flags it for local deletion on sync
|
||||||
entry_list_gen()
|
if argument == 'shear' or argument == '-rm':
|
||||||
_entry_name = str(input('What would you like to delete? '))
|
entry_list_gen()
|
||||||
|
_entry_name = str(input('What would you like to delete? '))
|
||||||
|
else:
|
||||||
|
_entry_name = argument.split(' ')
|
||||||
|
del _entry_name[:1]
|
||||||
|
_entry_name = ' '.join(_entry_name)
|
||||||
if _entry_name.startswith('/'):
|
if _entry_name.startswith('/'):
|
||||||
_entry_name = _entry_name.replace('/', '', 1)
|
_entry_name = _entry_name.replace('/', '', 1)
|
||||||
try:
|
try:
|
||||||
@@ -486,7 +529,7 @@ def remove_data(): # deletes an entry from the server and flags it for local de
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
# retrieve typed argument
|
# retrieve typed argument
|
||||||
argument_list, argument = argv, ''
|
argument_list, argument = argv, ''
|
||||||
argument_list.pop(0)
|
del argument_list[0]
|
||||||
for _argument in argument_list:
|
for _argument in argument_list:
|
||||||
argument += _argument + ' '
|
argument += _argument + ' '
|
||||||
argument = argument[:-1]
|
argument = argument[:-1]
|
||||||
@@ -533,45 +576,48 @@ if __name__ == "__main__":
|
|||||||
elif argument == 'help' or argument == '--help' or argument == '-h' or argument == 'license' or \
|
elif argument == 'help' or argument == '--help' or argument == '-h' or argument == 'license' or \
|
||||||
argument == 'version' or argument == '-v' or argument == 'add' or argument == 'edit' or argument == 'copy':
|
argument == 'version' or argument == '-v' or argument == 'add' or argument == 'edit' or argument == 'copy':
|
||||||
print_info()
|
print_info()
|
||||||
elif argument == 'add note' or argument == 'add -n' or argument == 'add password' or argument == 'add -p':
|
elif argument.startswith('add note') or argument.startswith('add -n') or argument.startswith('add password') \
|
||||||
|
or argument.startswith('add -p'):
|
||||||
try:
|
try:
|
||||||
add_entry()
|
add_entry()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print('\n')
|
print('\n')
|
||||||
s_exit()
|
s_exit()
|
||||||
elif argument == 'add folder' or argument == 'add -f':
|
elif argument.startswith('add folder') or argument.startswith('add -f'):
|
||||||
try:
|
try:
|
||||||
add_folder()
|
add_folder()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print('\n')
|
print('\n')
|
||||||
s_exit()
|
s_exit()
|
||||||
elif argument == 'edit rename' or argument == 'edit relocate' or argument == 'edit -r':
|
elif argument.startswith('edit rename') or argument.startswith('edit relocate') or argument.startswith('edit -r'):
|
||||||
try:
|
try:
|
||||||
rename()
|
rename()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print('\n')
|
print('\n')
|
||||||
s_exit()
|
s_exit()
|
||||||
elif argument == 'edit username' or argument == 'edit -u' or argument == 'edit password' or argument == 'edit -p' \
|
elif argument.startswith('edit username') or argument.startswith('edit -u') or argument.startswith('edit password')\
|
||||||
or argument == 'edit url' or argument == 'edit -l' or argument == 'edit note' or argument == 'edit -n':
|
or argument.startswith('edit -p') or argument.startswith('edit url') or argument.startswith('edit -l') or \
|
||||||
|
argument.startswith('edit note') or argument.startswith('edit -n'):
|
||||||
try:
|
try:
|
||||||
edit()
|
edit()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print('\n')
|
print('\n')
|
||||||
s_exit()
|
s_exit()
|
||||||
elif argument == 'gen' or argument == 'gen update' or argument == 'gen -u':
|
elif argument.startswith('gen'):
|
||||||
try:
|
try:
|
||||||
gen()
|
gen()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print('\n')
|
print('\n')
|
||||||
s_exit()
|
s_exit()
|
||||||
elif argument == 'copy username' or argument == 'copy -u' or argument == 'copy password' or argument == 'copy -p' \
|
elif argument.startswith('copy username') or argument.startswith('copy -u') or argument.startswith('copy password')\
|
||||||
or argument == 'copy url' or argument == 'copy -l' or argument == 'copy note' or argument == 'copy -n':
|
or argument.startswith('copy -p') or argument.startswith('copy url') or argument.startswith('copy -l')\
|
||||||
|
or argument.startswith('copy note') or argument.startswith('copy -n'):
|
||||||
try:
|
try:
|
||||||
copy_data()
|
copy_data()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print('\n')
|
print('\n')
|
||||||
s_exit()
|
s_exit()
|
||||||
elif argument == 'shear' or argument == '-rm':
|
elif argument.startswith('shear') or argument.startswith('-rm'):
|
||||||
try:
|
try:
|
||||||
remove_data()
|
remove_data()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
@@ -586,8 +632,10 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
# sync at end of program if any changes were made
|
# sync at end of program if any changes were made
|
||||||
if argument != '' and argument != 'help' and argument != '--help' and argument != '-h' and argument != 'license' \
|
if argument != '' and argument != 'help' and argument != '--help' and argument != '-h' and argument != 'license' \
|
||||||
and argument != 'add' and argument != 'sync' and argument != 'edit' and argument != 'copy username' and \
|
and argument != 'add' and argument != 'sync' and argument != 'edit' and not argument.\
|
||||||
argument != 'copy -u' and argument != 'copy password' and argument != 'copy -p' and argument != 'copy url' \
|
startswith('copy username') and not argument.startswith('copy -u') and not argument.\
|
||||||
and argument != 'copy -l' and argument != 'copy note' and argument != 'copy -n' and argument != 'copy' and \
|
startswith('copy password') and not argument.startswith('copy -p') and not argument.\
|
||||||
argument != 'version' and argument != '-v' and error == 0 and argument.startswith('/') is False:
|
startswith('copy url') and not argument.startswith('copy -l') and not argument.\
|
||||||
|
startswith('copy note') and not argument.startswith('copy -n') and argument != 'copy' and argument \
|
||||||
|
!= 'version' and argument != '-v' and error == 0 and argument.startswith('/') is False:
|
||||||
sync()
|
sync()
|
||||||
|
|||||||
@@ -1,33 +1,24 @@
|
|||||||
sshyp 2022.XX.XX.fr5
|
sshyp 2022.XX.XX.fr5
|
||||||
|
|
||||||
The sshyp Show Update
|
The Polished Trotters Update
|
||||||
|
|
||||||
This release focuses on improving the immediate user experience.
|
This release focuses on improving the overall user experience.
|
||||||
|
|
||||||
Features:
|
Features:
|
||||||
|
|
||||||
** majorly overhauled visual experience for sshyp
|
** majorly overhauled visual experience for sshyp
|
||||||
^ this includes a new entry list and thematic text art
|
^ this includes a new entry list and thematic text art
|
||||||
** entries can now optionally be passed as arguments to most functions
|
- entries can now optionally be passed as arguments, directly
|
||||||
^ as opposed to being entered after the primary command
|
^ as opposed to the user being prompted for an entry name after running a command
|
||||||
|
|
||||||
Changes:
|
Changes:
|
||||||
|
|
||||||
|
- corrected outdated liscensing and copyright information
|
||||||
|
- (openssh-9.0+) sshync now uses 'scp' (via the sftp protocal), rather than 'sftp'
|
||||||
|
- 'if __name__=="__main__":' convention is now used
|
||||||
|
** usage prompts now display in argparse format
|
||||||
** improved password generator to guarantee more secure results
|
** improved password generator to guarantee more secure results
|
||||||
|
** fixed multi-word syncing
|
||||||
&&
|
|
||||||
|
|
||||||
Planned for next, next major update (fr6, NAME PENDING):
|
|
||||||
|
|
||||||
** allow for copying entire notes (not just first line)
|
|
||||||
** separate sshync into its own repo and grant it standalone functionality
|
|
||||||
^ sshync will be able to be used as a general rsync alternative (more details in sshync repository, once it is created)
|
|
||||||
|
|
||||||
&&
|
|
||||||
|
|
||||||
Backlog:
|
|
||||||
|
|
||||||
** create separate gui frontend targetting mobile and desktop Linux
|
|
||||||
|
|
||||||
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
|
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user