diff --git a/bin/sshync.py b/bin/sshync.py index 1554d75..0649b38 100755 --- a/bin/sshync.py +++ b/bin/sshync.py @@ -2,11 +2,15 @@ # Main Targets: # TODO Make it so that when a new folder is created in sshyp, it is automatically created on the remote server -# TODO Replace references to rpass/sshyp directory with a changeable variable +# TODO Replace references to sshyp directory with a changeable variable # TODO Clean everything up and move sshync to a separate package # TODO Add dry run support +# TODO use partition command instead of split for separating paths +# TODO use classes! +# Long-er Term Targets: +# TODO -# sshync 2021.11.01.unreleased3 +# sshync 2021.11.04.unreleased4 # sshync was created to solve a problem with rpass/sshyp, and as such, sshync will be bundled with sshyp until it is # polished enough for a standalone release @@ -57,17 +61,17 @@ def get_file_paths_mod_remote(profile_dir): identity = profile_data[5].replace('\n', '') term("ssh -i " + "'" + identity + "'" + " -p " + port + " " + user + "@" + ip + " \"python -c \'import sshync; " "sshync.get_file_paths_mod(" + - "\"'\"" + remote_dir + "/\"'\", " + "\"'\"/var/lib/rpass/sshyncdatabase_names\"'\", " + - "\"'\"/var/lib/rpass/sshyncdatabase_times\"'\")\'\"") + "\"'\"" + remote_dir + "/\"'\", " + "\"'\"/var/lib/sshyp/sshyncdatabase_names\"'\", " + + "\"'\"/var/lib/sshyp/sshyncdatabase_times\"'\")\'\"") term( - 'sftp -P ' + port + ' ' + user + '@' + ip + ':/var/lib/rpass/sshyncdatabase_names ' + - '/var/lib/rpass/sshyncdatabase_names') + 'sftp -P ' + port + ' ' + user + '@' + ip + ':/var/lib/sshyp/sshyncdatabase_names ' + + '/var/lib/sshyp/sshyncdatabase_names') term( - 'sftp -P ' + port + ' ' + user + '@' + ip + ':/var/lib/rpass/sshyncdatabase_times ' + - '/var/lib/rpass/sshyncdatabase_times') - remote_mod_names = (open('/var/lib/rpass/sshyncdatabase_names').read()).replace('[', '').replace(']', '').replace( + 'sftp -P ' + port + ' ' + user + '@' + ip + ':/var/lib/sshyp/sshyncdatabase_times ' + + '/var/lib/sshyp/sshyncdatabase_times') + remote_mod_names = (open('/var/lib/sshyp/sshyncdatabase_names').read()).replace('[', '').replace(']', '').replace( ' ', '').replace("'", '').split(',') - remote_mod_times = (open('/var/lib/rpass/sshyncdatabase_times').read()).replace('[', '').replace(']', '').replace( + remote_mod_times = (open('/var/lib/sshyp/sshyncdatabase_times').read()).replace('[', '').replace(']', '').replace( ' ', '').replace("'", '').split(',') return remote_mod_names, remote_mod_times @@ -131,10 +135,10 @@ def run_profile(profile_dir): remote_dir = profile_data[4].replace('\n', '') identity = profile_data[5].replace('\n', '') # get file modification times - local_mod_names, local_mod_times = get_file_paths_mod(local_dir + '/', '/var/lib/rpass/sshyncdatabase_names', - '/var/lib/rpass/sshyncdatabase_times') + local_mod_names, local_mod_times = get_file_paths_mod(local_dir + '/', '/var/lib/sshyp/sshyncdatabase_names', + '/var/lib/sshyp/sshyncdatabase_times') remote_mod_times = [] - remote_mod_names, remote_mod_times_temp = get_file_paths_mod_remote('/var/lib/rpass/rpass.sshync') + remote_mod_names, remote_mod_times_temp = get_file_paths_mod_remote('/var/lib/sshyp/sshyp.sshync') for time in remote_mod_times_temp: # remove quotes from remote_mod_times remote_mod_times.append(float(time)) lmod_short = [] diff --git a/bin/sshyp b/bin/sshyp index fb173e0..ed66da6 100755 --- a/bin/sshyp +++ b/bin/sshyp @@ -7,6 +7,7 @@ from os import remove from os import environ from shutil import move from shutil import rmtree +from shutil import copy from sys import argv from re import search from re import escape @@ -113,7 +114,7 @@ if argument == 'version' or argument == '-v': print('/ /') print('/ sshyp Copyright (C) 2021 Randall Winkhart /') print('/ /') - print('/ Version 2021.11.01.fr1 /') + print('/ Version 2021.11.04.fr1 /') print('/ The sshync Update /') print('/ /') print('////////////////////////////////////////////////////////\n') @@ -142,6 +143,7 @@ if argument == 'config': if devicetype == 's' or devicetype == 'S': open("/var/lib/sshyp/sshyp-device", 'w').write(devicetype) print('\nMake sure the ssh service is running and properly configured.\n') + copy('/usr/bin/sshync.py', '/home/' + environ.get('USER') + '/') print('Configuration complete!\n') else: gpgid = '' @@ -186,12 +188,7 @@ if argument == 'config': ip, sep, port = ip_port.partition(':') usernamessh = str(input('What is the username of the remote server? ')) print('\nDefault directory: ' + '/home/' + usernamessh + '/.password-pasture/\n') - directoryssh = str(input('Is the remote server using the default password directory? (Y/n) ')) - if directoryssh == 'n' or directoryssh == 'N': - print('\nFormat: /this/path/ends/with/a/slash/\n') - directoryssh = str(input('What directory is the server using?: ')) - else: - directoryssh = ('/home/' + usernamessh + '/.password-pasture/') + directoryssh = ('/home/' + usernamessh + '/.password-pasture/') open("/var/lib/sshyp/sshyp-device", 'w').write(devicetype) sshync.make_profile('/var/lib/sshyp/sshyp.sshync', '/home/' + environ.get('USER') + '/.password-pasture/', directoryssh, '/home/' + environ.get('USER') + '/.ssh/sshyp', ip, port, usernamessh) diff --git a/share/doc/sshyp/changelog b/share/doc/sshyp/changelog index e95f909..b0a45f7 100644 --- a/share/doc/sshyp/changelog +++ b/share/doc/sshyp/changelog @@ -14,6 +14,8 @@ New features: Changes: - branding has been updated to reflect new project name and goals +- custom directories and ssh keys are removed (may be temporary) +- server installation makes copy of sshync.py in home directory Planned for next update (The Fluffy Update):