mirror of
https://github.com/rwinkhart/sshyp.git
synced 2026-09-03 23:57:17 -04:00
fixed client-side deletion via ssh
This commit is contained in:
+11
-5
@@ -130,7 +130,7 @@ if argument == 'version' or argument == '-v':
|
|||||||
print('/ /')
|
print('/ /')
|
||||||
print('/ rpass Copyright (C) 2021 Randall Winkhart /')
|
print('/ rpass Copyright (C) 2021 Randall Winkhart /')
|
||||||
print('/ /')
|
print('/ /')
|
||||||
print('/ Version 2021.09.14.pr4 /')
|
print('/ Version 2021.09.12.pr4 /')
|
||||||
print('/ The Housekeeping Update (Pt. 1) /')
|
print('/ The Housekeeping Update (Pt. 1) /')
|
||||||
print('/ /')
|
print('/ /')
|
||||||
print('////////////////////////////////////////////////////////')
|
print('////////////////////////////////////////////////////////')
|
||||||
@@ -219,6 +219,8 @@ if argument == 'config':
|
|||||||
f.write('rsync -v -H -r -l -t -p --delete -e ' + '"ssh -i ~/.ssh/rpass -p ' + port + '" ' + '\n')
|
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:
|
with open("/var/lib/rpass/rpassip", 'w') as f:
|
||||||
f.write(ip + '\n')
|
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()
|
||||||
@@ -251,6 +253,8 @@ with open("/var/lib/rpass/rpassrsyncdown") as f:
|
|||||||
rsyncdownn = f.read().strip()
|
rsyncdownn = f.read().strip()
|
||||||
with open("/var/lib/rpass/rpassip") as f:
|
with open("/var/lib/rpass/rpassip") as f:
|
||||||
ip = f.read().strip()
|
ip = f.read().strip()
|
||||||
|
with open("/var/lib/rpass/rpassport") as f:
|
||||||
|
port = f.read().strip()
|
||||||
with open("/var/lib/rpass/rpassuserssh") as f:
|
with open("/var/lib/rpass/rpassuserssh") as f:
|
||||||
usernamessh = f.read().strip()
|
usernamessh = f.read().strip()
|
||||||
|
|
||||||
@@ -634,10 +638,16 @@ if argument == 'remove' or argument == '-rm':
|
|||||||
entryname = str(input('What would you like to delete? '))
|
entryname = str(input('What would you like to delete? '))
|
||||||
if entryname.startswith('/'):
|
if entryname.startswith('/'):
|
||||||
if entryname.replace('/', '', 1).__contains__('/'):
|
if entryname.replace('/', '', 1).__contains__('/'):
|
||||||
|
term('ssh -p ' + port + '' + usernamessh + '@' + ip + ' rm -rf ' + "'" + directoryssh + "'" + entryname
|
||||||
|
.replace('/', '', 1) + '.gpg')
|
||||||
remove(directory + entryname.replace('/', '', 1) + '.gpg')
|
remove(directory + entryname.replace('/', '', 1) + '.gpg')
|
||||||
else:
|
else:
|
||||||
|
term('ssh -p ' + port + '' + usernamessh + '@' + ip + ' rm -rf ' + "'" + directoryssh + "'" + entryname
|
||||||
|
.replace('/', '', 1))
|
||||||
rmtree(directory + entryname.replace('/', '', 1))
|
rmtree(directory + entryname.replace('/', '', 1))
|
||||||
else:
|
else:
|
||||||
|
term('ssh -p ' + port + ' ' + usernamessh + '@' + ip + ' rm -rf ' + "'" + directoryssh + "'" + entryname +
|
||||||
|
'.gpg')
|
||||||
remove(directory + entryname + '.gpg')
|
remove(directory + entryname + '.gpg')
|
||||||
|
|
||||||
# permissions - applied pre-sync to ensure permissions are correct before upload
|
# permissions - applied pre-sync to ensure permissions are correct before upload
|
||||||
@@ -651,7 +661,3 @@ if argument.__contains__('add') or argument.__contains__('-rm') or argument.__co
|
|||||||
__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()
|
rsyncup()
|
||||||
rsyncdown()
|
rsyncdown()
|
||||||
print()
|
|
||||||
print('Please note that as of this time, entries can only be deleted if removed from the central server in a '
|
|
||||||
'client-server scenario. This will be adjusted soon.')
|
|
||||||
print()
|
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ Changes:
|
|||||||
- added version info argument
|
- added version info argument
|
||||||
- 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
|
||||||
**optimize code (specifically for when there is no folder but there is a slash)
|
**optimize code (specifically for when there is no folder but there is a slash)
|
||||||
**fix rsync delete on upload
|
|
||||||
**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