mirror of
https://github.com/rwinkhart/sshyp.git
synced 2026-09-04 08:07:15 -04:00
Allow sshync to work w/sshyp
This commit is contained in:
+17
-13
@@ -2,11 +2,15 @@
|
|||||||
|
|
||||||
# Main Targets:
|
# Main Targets:
|
||||||
# TODO Make it so that when a new folder is created in sshyp, it is automatically created on the remote server
|
# 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 Clean everything up and move sshync to a separate package
|
||||||
# TODO Add dry run support
|
# 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
|
# 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
|
# polished enough for a standalone release
|
||||||
|
|
||||||
@@ -57,17 +61,17 @@ def get_file_paths_mod_remote(profile_dir):
|
|||||||
identity = profile_data[5].replace('\n', '')
|
identity = profile_data[5].replace('\n', '')
|
||||||
term("ssh -i " + "'" + identity + "'" + " -p " + port + " " + user + "@" + ip + " \"python -c \'import sshync; "
|
term("ssh -i " + "'" + identity + "'" + " -p " + port + " " + user + "@" + ip + " \"python -c \'import sshync; "
|
||||||
"sshync.get_file_paths_mod(" +
|
"sshync.get_file_paths_mod(" +
|
||||||
"\"'\"" + remote_dir + "/\"'\", " + "\"'\"/var/lib/rpass/sshyncdatabase_names\"'\", " +
|
"\"'\"" + remote_dir + "/\"'\", " + "\"'\"/var/lib/sshyp/sshyncdatabase_names\"'\", " +
|
||||||
"\"'\"/var/lib/rpass/sshyncdatabase_times\"'\")\'\"")
|
"\"'\"/var/lib/sshyp/sshyncdatabase_times\"'\")\'\"")
|
||||||
term(
|
term(
|
||||||
'sftp -P ' + port + ' ' + user + '@' + ip + ':/var/lib/rpass/sshyncdatabase_names ' +
|
'sftp -P ' + port + ' ' + user + '@' + ip + ':/var/lib/sshyp/sshyncdatabase_names ' +
|
||||||
'/var/lib/rpass/sshyncdatabase_names')
|
'/var/lib/sshyp/sshyncdatabase_names')
|
||||||
term(
|
term(
|
||||||
'sftp -P ' + port + ' ' + user + '@' + ip + ':/var/lib/rpass/sshyncdatabase_times ' +
|
'sftp -P ' + port + ' ' + user + '@' + ip + ':/var/lib/sshyp/sshyncdatabase_times ' +
|
||||||
'/var/lib/rpass/sshyncdatabase_times')
|
'/var/lib/sshyp/sshyncdatabase_times')
|
||||||
remote_mod_names = (open('/var/lib/rpass/sshyncdatabase_names').read()).replace('[', '').replace(']', '').replace(
|
remote_mod_names = (open('/var/lib/sshyp/sshyncdatabase_names').read()).replace('[', '').replace(']', '').replace(
|
||||||
' ', '').replace("'", '').split(',')
|
' ', '').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(',')
|
' ', '').replace("'", '').split(',')
|
||||||
return remote_mod_names, remote_mod_times
|
return remote_mod_names, remote_mod_times
|
||||||
|
|
||||||
@@ -131,10 +135,10 @@ def run_profile(profile_dir):
|
|||||||
remote_dir = profile_data[4].replace('\n', '')
|
remote_dir = profile_data[4].replace('\n', '')
|
||||||
identity = profile_data[5].replace('\n', '')
|
identity = profile_data[5].replace('\n', '')
|
||||||
# get file modification times
|
# get file modification times
|
||||||
local_mod_names, local_mod_times = get_file_paths_mod(local_dir + '/', '/var/lib/rpass/sshyncdatabase_names',
|
local_mod_names, local_mod_times = get_file_paths_mod(local_dir + '/', '/var/lib/sshyp/sshyncdatabase_names',
|
||||||
'/var/lib/rpass/sshyncdatabase_times')
|
'/var/lib/sshyp/sshyncdatabase_times')
|
||||||
remote_mod_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
|
for time in remote_mod_times_temp: # remove quotes from remote_mod_times
|
||||||
remote_mod_times.append(float(time))
|
remote_mod_times.append(float(time))
|
||||||
lmod_short = []
|
lmod_short = []
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ from os import remove
|
|||||||
from os import environ
|
from os import environ
|
||||||
from shutil import move
|
from shutil import move
|
||||||
from shutil import rmtree
|
from shutil import rmtree
|
||||||
|
from shutil import copy
|
||||||
from sys import argv
|
from sys import argv
|
||||||
from re import search
|
from re import search
|
||||||
from re import escape
|
from re import escape
|
||||||
@@ -113,7 +114,7 @@ if argument == 'version' or argument == '-v':
|
|||||||
print('/ /')
|
print('/ /')
|
||||||
print('/ sshyp Copyright (C) 2021 Randall Winkhart /')
|
print('/ sshyp Copyright (C) 2021 Randall Winkhart /')
|
||||||
print('/ /')
|
print('/ /')
|
||||||
print('/ Version 2021.11.01.fr1 /')
|
print('/ Version 2021.11.04.fr1 /')
|
||||||
print('/ The sshync Update /')
|
print('/ The sshync Update /')
|
||||||
print('/ /')
|
print('/ /')
|
||||||
print('////////////////////////////////////////////////////////\n')
|
print('////////////////////////////////////////////////////////\n')
|
||||||
@@ -142,6 +143,7 @@ if argument == 'config':
|
|||||||
if devicetype == 's' or devicetype == 'S':
|
if devicetype == 's' or devicetype == 'S':
|
||||||
open("/var/lib/sshyp/sshyp-device", 'w').write(devicetype)
|
open("/var/lib/sshyp/sshyp-device", 'w').write(devicetype)
|
||||||
print('\nMake sure the ssh service is running and properly configured.\n')
|
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')
|
print('Configuration complete!\n')
|
||||||
else:
|
else:
|
||||||
gpgid = ''
|
gpgid = ''
|
||||||
@@ -186,12 +188,7 @@ if argument == 'config':
|
|||||||
ip, sep, port = ip_port.partition(':')
|
ip, sep, port = ip_port.partition(':')
|
||||||
usernamessh = str(input('What is the username of the remote server? '))
|
usernamessh = str(input('What is the username of the remote server? '))
|
||||||
print('\nDefault directory: ' + '/home/' + usernamessh + '/.password-pasture/\n')
|
print('\nDefault directory: ' + '/home/' + usernamessh + '/.password-pasture/\n')
|
||||||
directoryssh = str(input('Is the remote server using the default password directory? (Y/n) '))
|
directoryssh = ('/home/' + usernamessh + '/.password-pasture/')
|
||||||
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/')
|
|
||||||
open("/var/lib/sshyp/sshyp-device", 'w').write(devicetype)
|
open("/var/lib/sshyp/sshyp-device", 'w').write(devicetype)
|
||||||
sshync.make_profile('/var/lib/sshyp/sshyp.sshync', '/home/' + environ.get('USER') + '/.password-pasture/',
|
sshync.make_profile('/var/lib/sshyp/sshyp.sshync', '/home/' + environ.get('USER') + '/.password-pasture/',
|
||||||
directoryssh, '/home/' + environ.get('USER') + '/.ssh/sshyp', ip, port, usernamessh)
|
directoryssh, '/home/' + environ.get('USER') + '/.ssh/sshyp', ip, port, usernamessh)
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ New features:
|
|||||||
Changes:
|
Changes:
|
||||||
|
|
||||||
- branding has been updated to reflect new project name and goals
|
- 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):
|
Planned for next update (The Fluffy Update):
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user