mirror of
https://github.com/rwinkhart/sshyp.git
synced 2026-09-05 16:47:14 -04:00
condensed config files
This commit is contained in:
+14
-35
@@ -51,14 +51,6 @@ def encryptfolder():
|
|||||||
rmtree('/dev/shm/' + shmfolder)
|
rmtree('/dev/shm/' + shmfolder)
|
||||||
|
|
||||||
|
|
||||||
def rsyncup():
|
|
||||||
term(rsyncupp + ' ' + directory + ' ' + usernamessh + '@' + ip + ':' + directoryssh)
|
|
||||||
|
|
||||||
|
|
||||||
def rsyncdown():
|
|
||||||
term(rsyncdownn + ' ' + usernamessh + '@' + ip + ':' + directoryssh + ' ' + directory)
|
|
||||||
|
|
||||||
|
|
||||||
# argument - filter the argument to usable text - some replacements are only done once to prevent interference
|
# argument - filter the argument to usable text - some replacements are only done once to prevent interference
|
||||||
|
|
||||||
argument = str(argv).replace('[', '', 1).replace(']', '', 1).replace(',', '').replace("'", '') \
|
argument = str(argv).replace('[', '', 1).replace(']', '', 1).replace(',', '').replace("'", '') \
|
||||||
@@ -209,18 +201,8 @@ if argument == 'config':
|
|||||||
print()
|
print()
|
||||||
ip_port = str(input('What is the IP and ssh port of the remote server? '))
|
ip_port = str(input('What is the IP and ssh port of the remote server? '))
|
||||||
print()
|
print()
|
||||||
usernamessh = str(input('What is the username of the remote server? '))
|
|
||||||
ip, sep, port = ip_port.partition(':')
|
ip, sep, port = ip_port.partition(':')
|
||||||
with open("/var/lib/rpass/rpassuserssh", 'w') as f:
|
usernamessh = str(input('What is the username of the remote server? '))
|
||||||
f.write(usernamessh + '\n')
|
|
||||||
with open("/var/lib/rpass/rpassrsyncup", 'w') as f:
|
|
||||||
f.write('rsync -v -H -r -l -t -p -e ' + '"ssh -i ~/.ssh/rpass -p ' + port + '" ' + '\n')
|
|
||||||
with open("/var/lib/rpass/rpassrsyncdown", 'w') as f:
|
|
||||||
f.write('rsync -v -H -r -l -t -p --delete -e ' + '"ssh -i ~/.ssh/rpass -p ' + port + '" ' + '\n')
|
|
||||||
with open("/var/lib/rpass/rpassip", 'w') as f:
|
|
||||||
f.write(ip + '\n')
|
|
||||||
with open("/var/lib/rpass/rpassport", 'w') as f:
|
|
||||||
f.write(port + '\n')
|
|
||||||
print()
|
print()
|
||||||
print('Default directory: ' + '/home/' + usernamessh + '/.rpass-store/')
|
print('Default directory: ' + '/home/' + usernamessh + '/.rpass-store/')
|
||||||
print()
|
print()
|
||||||
@@ -232,31 +214,26 @@ if argument == 'config':
|
|||||||
print('Format: /this/path/ends/with/a/slash/')
|
print('Format: /this/path/ends/with/a/slash/')
|
||||||
print()
|
print()
|
||||||
directoryssh = str(input('What directory is the server using?: '))
|
directoryssh = str(input('What directory is the server using?: '))
|
||||||
with open("/var/lib/rpass/rpassdirssh", 'w') as f:
|
with open("/var/lib/rpass/rpass-ssh", 'w') as f:
|
||||||
f.write(directoryssh + '\n')
|
f.write(usernamessh + '\n' + ip + '\n' + port + '\n' + directoryssh)
|
||||||
print()
|
print()
|
||||||
print('Configuration complete!')
|
print('Configuration complete!')
|
||||||
print()
|
print()
|
||||||
|
|
||||||
# import userdata
|
# import userdata
|
||||||
|
|
||||||
|
sshinfo = open("/var/lib/rpass/rpass-ssh").readlines()
|
||||||
|
usernamessh = sshinfo[0].replace('\n', '')
|
||||||
|
ip = sshinfo[1].replace('\n', '')
|
||||||
|
port = sshinfo[2].replace('\n', '')
|
||||||
|
directoryssh = sshinfo[3].replace('\n', '')
|
||||||
with open("/var/lib/rpass/rpassgpg") as f:
|
with open("/var/lib/rpass/rpassgpg") as f:
|
||||||
gpgid = f.read().strip()
|
gpgid = f.read().strip()
|
||||||
with open("/var/lib/rpass/rpassdir") as f:
|
with open("/var/lib/rpass/rpassdir") as f:
|
||||||
directory = f.read().strip()
|
directory = f.read().strip()
|
||||||
term('mkdir -p ' + directory)
|
term('mkdir -p ' + directory)
|
||||||
with open("/var/lib/rpass/rpassdirssh") as f:
|
|
||||||
directoryssh = f.read().strip()
|
# no argument
|
||||||
with open("/var/lib/rpass/rpassrsyncup") as f:
|
|
||||||
rsyncupp = f.read().strip()
|
|
||||||
with open("/var/lib/rpass/rpassrsyncdown") as f:
|
|
||||||
rsyncdownn = f.read().strip()
|
|
||||||
with open("/var/lib/rpass/rpassip") as f:
|
|
||||||
ip = f.read().strip()
|
|
||||||
with open("/var/lib/rpass/rpassport") as f:
|
|
||||||
port = f.read().strip()
|
|
||||||
with open("/var/lib/rpass/rpassuserssh") as f:
|
|
||||||
usernamessh = f.read().strip()
|
|
||||||
|
|
||||||
if argument == '':
|
if argument == '':
|
||||||
print()
|
print()
|
||||||
@@ -659,5 +636,7 @@ term('find ' + directory + ' -type f -exec chmod -R 600 {} +')
|
|||||||
|
|
||||||
if argument.__contains__('add') or argument.__contains__('-rm') or argument.__contains__('remove') or argument. \
|
if argument.__contains__('add') or argument.__contains__('-rm') or argument.__contains__('remove') or argument. \
|
||||||
__contains__('edit') or argument.__contains__('gen') or argument == 'sync' or argument == '-s':
|
__contains__('edit') or argument.__contains__('gen') or argument == 'sync' or argument == '-s':
|
||||||
rsyncup()
|
term('rsync -v -H -r -l -t -p -e ' + '"ssh -i ~/.ssh/rpass -p ' + port + '" ' + directory + ' ' + usernamessh
|
||||||
rsyncdown()
|
+ '@' + ip + ':' + directoryssh)
|
||||||
|
term('rsync -v -H -r -l -t -p --delete -e ' + '"ssh -i ~/.ssh/rpass -p ' + port + '" ' + usernamessh
|
||||||
|
+ '@' + ip + ':' + directoryssh + ' ' + directory)
|
||||||
|
|||||||
@@ -23,7 +23,9 @@ Changes:
|
|||||||
- re-ordered config wizard for better rsync support
|
- re-ordered config wizard for better rsync support
|
||||||
- optimized code for random string generation in /dev/shm
|
- optimized code for random string generation in /dev/shm
|
||||||
- entry deletion can now be done client-side
|
- entry deletion can now be done client-side
|
||||||
**optimize code (specifically for when there is no folder but there is a slash)
|
- removed rsyncup/rsyncdown/username/ip/port/directoryssh files,
|
||||||
|
^ replaced with one file that holds usernamessh, ip, port, and directoryssh
|
||||||
|
**optimize code for when there is no folder but there is a slash)
|
||||||
**properly comment the code
|
**properly comment the code
|
||||||
**validate for Python 3.10
|
**validate for Python 3.10
|
||||||
**do a better job at clearing /dev/shm
|
**do a better job at clearing /dev/shm
|
||||||
|
|||||||
Reference in New Issue
Block a user