diff --git a/bin/sshyp b/bin/sshyp index 646d483..c0bb132 100755 --- a/bin/sshyp +++ b/bin/sshyp @@ -49,7 +49,7 @@ def edit_note(_shm_folder, _shm_entry): def tweak(): # runs configuration wizard # storage/config directory creation try: - mkdir(f"{path.expanduser('~')}/.password-pasture", 0o700) + mkdir(path.expanduser('~/.password-pasture'), 0o700) except FileExistsError: pass try: @@ -60,14 +60,14 @@ def tweak(): # runs configuration wizard # device type configuration _device_type = input('\nIs this installation for a client or for a server? (C/s) ') if _device_type.lower() == 's': - open(f"{path.expanduser('~/.config/sshyp')}/sshyp-device", 'w').write(_device_type) + open(path.expanduser('~/.config/sshyp/sshyp-device'), 'w').write(_device_type) copy('/usr/bin/sshync.py', path.expanduser('~/')) print('\nMake sure the ssh service is running and properly configured.\n\nConfiguration complete!\n') s_exit() else: # device type configuration _device_type = 'c' # ensure device type flag is properly set - open(f"{path.expanduser('~/.config/sshyp')}/sshyp-device", 'w').write(_device_type) + open(path.expanduser('~/.config/sshyp/sshyp-device'), 'w').write(_device_type) # gpg configuration _gpg_id = input('\nsshyp requires the use of a unique gpg key. Do you already have one that you are ' @@ -76,14 +76,14 @@ def tweak(): # runs configuration wizard print('\nA unique gpg key has been generated for you.') system('gpg --full-generate-key') _gpg_id = str(input('\nPlease input the ID of your gpg key: ')) - open(f"{path.expanduser('~/.config/sshyp')}/sshyp-gpg", 'w').write(_gpg_id + '\n') + open(path.expanduser('~/.config/sshyp/sshyp-gpg'), 'w').write(_gpg_id + '\n') # lock file generation try: - open(f"{path.expanduser('~/.config/sshyp')}/lock", 'x').write('') + open(path.expanduser('~/.config/sshyp/lock'), 'x').write('') except FileExistsError: pass - system(f"gpg -r {str(_gpg_id)} -e {path.expanduser('~/.config/sshyp')}/lock") + system(f"gpg -r {str(_gpg_id)} -e {path.expanduser('~/.config/sshyp/lock')}") remove(f"{path.expanduser('~/.config/sshyp')}/lock") # ssh key configuration @@ -93,7 +93,7 @@ def tweak(): # runs configuration wizard if _ssh_gen.lower() != 'n': system('ssh-keygen -t ed25519 -f ~/.ssh/sshyp') else: - print(f"\nEnsure that the key file you are using is located at {path.expanduser('~')}/.ssh/sshyp") + print(f"\nEnsure that the key file you are using is located at {path.expanduser('~/.ssh/sshyp')}") # ssh ip+port configuration print('\nExample input: 10.10.10.10:9999\n') @@ -105,9 +105,9 @@ def tweak(): # runs configuration wizard print(f"\nEntry directory: /home/{_username_ssh}/.password-pasture/") # sshync profile generation - sshync.make_profile(f"{path.expanduser('~/.config/sshyp')}/sshyp.sshync", - f"{path.expanduser('~')}/.password-pasture/", f"/home/{_username_ssh}/.password-pasture/", - f"{path.expanduser('~')}/.ssh/sshyp", _ip, _port, _username_ssh) + sshync.make_profile(path.expanduser('~/.config/sshyp/sshyp.sshync'), + path.expanduser('~/.password-pasture/'), f"/home/{_username_ssh}/.password-pasture/", + path.expanduser('~/.ssh/sshyp'), _ip, _port, _username_ssh) print('\nConfiguration complete!\n') @@ -152,8 +152,8 @@ def print_info(): # prints help text based on argument print('/ /') print('/ sshyp Copyright (C) 2021 Randall Winkhart /') print('/ /') - print('/ Version 2022.01.13.fr3 /') - print('/ The Boxing Update /') + print('/ Version 2022.01.13.fr3.1 /') + print('/ The Boxing Update /') print('/ /') print('////////////////////////////////////////////////////////\n') elif argument == 'license': @@ -206,7 +206,7 @@ def sync(): # calls sshync to sync changes to the user's server # set permissions before uploading system('find ' + directory + ' -type d -exec chmod -R 700 {} +') system('find ' + directory + ' -type f -exec chmod -R 600 {} +') - sshync.run_profile(f"{path.expanduser('~/.config/sshyp')}/sshyp.sshync") + sshync.run_profile(path.expanduser('~/.config/sshyp/sshyp.sshync')) def add_entry(): # adds a new entry @@ -381,7 +381,7 @@ def remove_data(): # deletes an entry or folder from both the client and the se if _entry_name.startswith('/'): _entry_name = _entry_name.replace('/', '', 1) try: - system(f"gpg -d --output /dev/shm/sshyp.lock {path.expanduser('~/.config/sshyp')}/lock.gpg") + system(f"gpg -d --output /dev/shm/sshyp.lock {path.expanduser('~/.config/sshyp/lock.gpg')}") _unlock = open('/dev/shm/sshyp.lock', 'r').readlines() remove('/dev/shm/sshyp.lock') except FileNotFoundError: @@ -407,10 +407,10 @@ argument = argument[:-1] if argument != 'tweak': device_type = '' try: - device_type = open(f"{path.expanduser('~/.config/sshyp')}/sshyp-device").read().strip() + device_type = open(path.expanduser('~/.config/sshyp/sshyp-device')).read().strip() if device_type == 'c': - gpg_id = open(f"{path.expanduser('~/.config/sshyp')}/sshyp-gpg").read().strip() - ssh_info = sshync.get_profile(f"{path.expanduser('~/.config/sshyp')}/sshyp.sshync") + gpg_id = open(path.expanduser('~/.config/sshyp/sshyp-gpg')).read().strip() + ssh_info = sshync.get_profile(path.expanduser('~/.config/sshyp/sshyp.sshync')) username_ssh = ssh_info[0].replace('\n', '') ip = ssh_info[1].replace('\n', '') port = ssh_info[2].replace('\n', '')