mirror of
https://github.com/rwinkhart/sshyp.git
synced 2026-09-03 07:37:16 -04:00
Added multi-line notes support
This commit is contained in:
+50
-17
@@ -23,10 +23,10 @@ def term(cmd):
|
|||||||
|
|
||||||
|
|
||||||
def replace_line(file_name, line_num, text):
|
def replace_line(file_name, line_num, text):
|
||||||
lines = open(file_name, 'r').readlines()
|
xlines = open(file_name, 'r').readlines()
|
||||||
lines[line_num] = text
|
xlines[line_num] = text
|
||||||
out = open(file_name, 'w')
|
out = open(file_name, 'w')
|
||||||
out.writelines(lines)
|
out.writelines(xlines)
|
||||||
out.close()
|
out.close()
|
||||||
|
|
||||||
|
|
||||||
@@ -101,8 +101,8 @@ 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.10.08.mr5 /')
|
print('/ Version 2021.10.08.mr5 /')
|
||||||
print('/ The Housekeeping Update (Pt. 2) /')
|
print('/ The Notetaker Update /')
|
||||||
print('/ /')
|
print('/ /')
|
||||||
print('////////////////////////////////////////////////////////\n')
|
print('////////////////////////////////////////////////////////\n')
|
||||||
|
|
||||||
@@ -263,28 +263,30 @@ if argument == 'add note' or argument == 'add -n':
|
|||||||
try:
|
try:
|
||||||
clear()
|
clear()
|
||||||
entryname = str(input('Name of note: '))
|
entryname = str(input('Name of note: '))
|
||||||
notes = str(input('Contents of note: '))
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
entryname, notes = (0, 0)
|
entryname, notes = (0, 0)
|
||||||
print('\n\nEntry add cancelled.\n')
|
print('\n\nEntry add cancelled.\n')
|
||||||
exit()
|
exit()
|
||||||
shmfolder, shmentry = shmgen()
|
shmfolder, shmentry = shmgen()
|
||||||
|
term('nano /dev/shm/' + shmfolder + '/' + shmentry + '-n')
|
||||||
|
with open('/dev/shm/' + shmfolder + '/' + shmentry + '-n', 'r') as file:
|
||||||
|
notes = file.read().replace('/n', '')
|
||||||
try:
|
try:
|
||||||
if entryname.startswith('/'): # check if user input contains slashes
|
if entryname.startswith('/'): # check if user input contains slashes
|
||||||
if entryname.replace('/', '', 1).__contains__('/'): # create folder and entry if there are two slashes
|
if entryname.replace('/', '', 1).__contains__('/'): # create folder and entry if there are two slashes
|
||||||
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
||||||
with open('/dev/shm/' + shmfolder + '/' + shmentry, 'w') as f:
|
with open('/dev/shm/' + shmfolder + '/' + shmentry, 'w') as f:
|
||||||
f.writelines('\n\n\n' + notes + '\n\n')
|
f.writelines('\n\n\n\n' + notes + '\n\n')
|
||||||
encryptfolder()
|
encryptfolder()
|
||||||
term('gpg -d ' + directory + folder + '/' + "'" + folderentry + '.gpg' + "'")
|
term('gpg -d ' + directory + folder + '/' + "'" + folderentry + '.gpg' + "'")
|
||||||
else: # create entry if there is only one slash
|
else: # create entry if there is only one slash
|
||||||
with open('/dev/shm/' + shmfolder + '/' + shmentry, 'w') as f:
|
with open('/dev/shm/' + shmfolder + '/' + shmentry, 'w') as f:
|
||||||
f.writelines('\n\n\n' + notes + '\n\n')
|
f.writelines('\n\n\n\n' + notes + '\n\n')
|
||||||
encrypt()
|
encrypt()
|
||||||
term('gpg -d ' + directory + "'" + entryname.replace('/', '', 1) + '.gpg' + "'")
|
term('gpg -d ' + directory + "'" + entryname.replace('/', '', 1) + '.gpg' + "'")
|
||||||
else: # create entry if there are no slashes
|
else: # create entry if there are no slashes
|
||||||
with open('/dev/shm/' + shmfolder + '/' + shmentry, 'w') as f:
|
with open('/dev/shm/' + shmfolder + '/' + shmentry, 'w') as f:
|
||||||
f.writelines('\n\n\n' + notes + '\n\n')
|
f.writelines('\n\n\n\n' + notes + '\n\n')
|
||||||
encrypt()
|
encrypt()
|
||||||
term('gpg -d ' + directory + "'" + entryname + '.gpg' + "'")
|
term('gpg -d ' + directory + "'" + entryname + '.gpg' + "'")
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
@@ -301,28 +303,30 @@ if argument == 'add password' or argument == 'add -p':
|
|||||||
username = str(input('Username: '))
|
username = str(input('Username: '))
|
||||||
password = str(input('Password: '))
|
password = str(input('Password: '))
|
||||||
url = str(input('URL: '))
|
url = str(input('URL: '))
|
||||||
notes = str(input('Additional notes: '))
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
entryname, username, password, url, notes = (0, 0, 0, 0, 0)
|
entryname, username, password, url, notes = (0, 0, 0, 0, 0)
|
||||||
print('\n\nEntry add cancelled.\n')
|
print('\n\nEntry add cancelled.\n')
|
||||||
exit()
|
exit()
|
||||||
shmfolder, shmentry = shmgen()
|
shmfolder, shmentry = shmgen()
|
||||||
|
term('nano /dev/shm/' + shmfolder + '/' + shmentry + '-n')
|
||||||
|
with open('/dev/shm/' + shmfolder + '/' + shmentry + '-n', 'r') as file:
|
||||||
|
notes = file.read().replace('/n', '')
|
||||||
try:
|
try:
|
||||||
if entryname.startswith('/'):
|
if entryname.startswith('/'):
|
||||||
if entryname.replace('/', '', 1).__contains__('/'):
|
if entryname.replace('/', '', 1).__contains__('/'):
|
||||||
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
||||||
with open('/dev/shm/' + shmfolder + '/' + shmentry, 'w') as f:
|
with open('/dev/shm/' + shmfolder + '/' + shmentry, 'w') as f:
|
||||||
f.writelines(username + '\n' + password + '\n' + url + '\n' + notes + '\n\n')
|
f.writelines(username + '\n' + password + '\n' + url + '\n\n' + notes + '\n\n')
|
||||||
encryptfolder()
|
encryptfolder()
|
||||||
term('gpg -d ' + directory + folder + '/' + "'" + folderentry + '.gpg' + "'")
|
term('gpg -d ' + directory + folder + '/' + "'" + folderentry + '.gpg' + "'")
|
||||||
else:
|
else:
|
||||||
with open('/dev/shm/' + shmfolder + '/' + shmentry, 'w') as f:
|
with open('/dev/shm/' + shmfolder + '/' + shmentry, 'w') as f:
|
||||||
f.writelines(username + '\n' + password + '\n' + url + '\n' + notes + '\n\n')
|
f.writelines(username + '\n' + password + '\n' + url + '\n\n' + notes + '\n\n')
|
||||||
encrypt()
|
encrypt()
|
||||||
term('gpg -d ' + directory + "'" + entryname.replace('/', '', 1) + '.gpg' + "'")
|
term('gpg -d ' + directory + "'" + entryname.replace('/', '', 1) + '.gpg' + "'")
|
||||||
else:
|
else:
|
||||||
with open('/dev/shm/' + shmfolder + '/' + shmentry, 'w') as f:
|
with open('/dev/shm/' + shmfolder + '/' + shmentry, 'w') as f:
|
||||||
f.writelines(username + '\n' + password + '\n' + url + '\n' + notes + '\n\n')
|
f.writelines(username + '\n' + password + '\n' + url + '\n\n' + notes + '\n\n')
|
||||||
encrypt()
|
encrypt()
|
||||||
term('gpg -d ' + directory + "'" + entryname + '.gpg' + "'")
|
term('gpg -d ' + directory + "'" + entryname + '.gpg' + "'")
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
@@ -505,7 +509,6 @@ if argument == 'edit note' or argument == 'edit -n':
|
|||||||
term('cd ' + directory + '; ls -1 *')
|
term('cd ' + directory + '; ls -1 *')
|
||||||
print()
|
print()
|
||||||
entryname = str(input('What file would you like to edit? '))
|
entryname = str(input('What file would you like to edit? '))
|
||||||
notes = str(input('New Note: '))
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
entryname, notes = (0, 0)
|
entryname, notes = (0, 0)
|
||||||
print('\n\nEdit cancelled.\n')
|
print('\n\nEdit cancelled.\n')
|
||||||
@@ -517,20 +520,50 @@ if argument == 'edit note' or argument == 'edit -n':
|
|||||||
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
||||||
term('gpg -d --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory +
|
term('gpg -d --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory +
|
||||||
folder + '/' + folderentry + '.gpg')
|
folder + '/' + folderentry + '.gpg')
|
||||||
replace_line('/dev/shm/' + shmfolder + '/' + shmentry, 3, notes + '\n')
|
with open('/dev/shm/' + shmfolder + '/' + shmentry) as first:
|
||||||
|
lines = first.readlines()
|
||||||
|
with open('/dev/shm/' + shmfolder + '/' + shmentry, 'w') as first:
|
||||||
|
first.writelines(lines[0:3])
|
||||||
|
with open('/dev/shm/' + shmfolder + '/' + shmentry + '-n', 'w') as second:
|
||||||
|
second.writelines(lines[4:-2])
|
||||||
|
term('nano /dev/shm/' + shmfolder + '/' + shmentry + '-n')
|
||||||
|
with open('/dev/shm/' + shmfolder + '/' + shmentry + '-n') as second:
|
||||||
|
notes = second.read()
|
||||||
|
with open('/dev/shm/' + shmfolder + '/' + shmentry, 'a') as first:
|
||||||
|
first.write('\n' + notes + '\n\n')
|
||||||
remove(directory + folder + '/' + folderentry + '.gpg')
|
remove(directory + folder + '/' + folderentry + '.gpg')
|
||||||
encryptfolder()
|
encryptfolder()
|
||||||
term('gpg -d ' + directory + folder + '/' + "'" + folderentry + '.gpg' + "'")
|
term('gpg -d ' + directory + folder + '/' + "'" + folderentry + '.gpg' + "'")
|
||||||
else:
|
else:
|
||||||
term('gpg -d --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory +
|
term('gpg -d --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory +
|
||||||
entryname.replace('/', '', 1) + '.gpg')
|
entryname.replace('/', '', 1) + '.gpg')
|
||||||
replace_line('/dev/shm/' + shmfolder + '/' + shmentry, 3, notes + '\n')
|
with open('/dev/shm/' + shmfolder + '/' + shmentry) as first:
|
||||||
|
lines = first.readlines()
|
||||||
|
with open('/dev/shm/' + shmfolder + '/' + shmentry, 'w') as first:
|
||||||
|
first.writelines(lines[0:3])
|
||||||
|
with open('/dev/shm/' + shmfolder + '/' + shmentry + '-n', 'w') as second:
|
||||||
|
second.writelines(lines[4:-2])
|
||||||
|
term('nano /dev/shm/' + shmfolder + '/' + shmentry + '-n')
|
||||||
|
with open('/dev/shm/' + shmfolder + '/' + shmentry + '-n') as second:
|
||||||
|
notes = second.read()
|
||||||
|
with open('/dev/shm/' + shmfolder + '/' + shmentry, 'a') as first:
|
||||||
|
first.write('\n' + notes + '\n\n')
|
||||||
remove(directory + entryname.replace('/', '', 1) + '.gpg')
|
remove(directory + entryname.replace('/', '', 1) + '.gpg')
|
||||||
encrypt()
|
encrypt()
|
||||||
term('gpg -d ' + directory + "'" + entryname.replace('/', '', 1) + '.gpg' + "'")
|
term('gpg -d ' + directory + "'" + entryname.replace('/', '', 1) + '.gpg' + "'")
|
||||||
else:
|
else:
|
||||||
term('gpg -d --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory + entryname + '.gpg')
|
term('gpg -d --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory + entryname + '.gpg')
|
||||||
replace_line('/dev/shm/' + shmfolder + '/' + shmentry, 3, notes + '\n')
|
with open('/dev/shm/' + shmfolder + '/' + shmentry) as first:
|
||||||
|
lines = first.readlines()
|
||||||
|
with open('/dev/shm/' + shmfolder + '/' + shmentry, 'w') as first:
|
||||||
|
first.writelines(lines[0:3])
|
||||||
|
with open('/dev/shm/' + shmfolder + '/' + shmentry + '-n', 'w') as second:
|
||||||
|
second.writelines(lines[4:-2])
|
||||||
|
term('nano /dev/shm/' + shmfolder + '/' + shmentry + '-n')
|
||||||
|
with open('/dev/shm/' + shmfolder + '/' + shmentry + '-n') as second:
|
||||||
|
notes = second.read()
|
||||||
|
with open('/dev/shm/' + shmfolder + '/' + shmentry, 'a') as first:
|
||||||
|
first.write('\n' + notes + '\n\n')
|
||||||
remove(directory + entryname + '.gpg')
|
remove(directory + entryname + '.gpg')
|
||||||
encrypt()
|
encrypt()
|
||||||
term('gpg -d ' + directory + "'" + entryname + '.gpg' + "'")
|
term('gpg -d ' + directory + "'" + entryname + '.gpg' + "'")
|
||||||
@@ -2,27 +2,32 @@
|
|||||||
|
|
||||||
rpass 2021.10.08.mr5
|
rpass 2021.10.08.mr5
|
||||||
|
|
||||||
The Housekeeping Update (Pt. 2) - Fifth main release of rpass
|
The Notetaker Update - Fifth main release of rpass
|
||||||
|
|
||||||
This release focuses on user-facing polish and usability enhancements.
|
This release focuses on user-facing polish and usability enhancements.
|
||||||
|
|
||||||
New features:
|
New features:
|
||||||
|
|
||||||
**add new file list w/color and w/o extensions
|
- notes are now edited in nano and can be split across multiple lines
|
||||||
**add support for multi-line notes (use text editor for notes)
|
|
||||||
|
|
||||||
Changes:
|
Changes:
|
||||||
|
|
||||||
- fixed issues with copying passwords with certain special characters, e.g. '"()|
|
- fixed issues with copying passwords with certain special characters, e.g. '"()|
|
||||||
- auto-generated ssh key now uses ed25519, rather than rsa-3072
|
- auto-generated ssh key now uses ed25519, rather than rsa-3072
|
||||||
**add more comments to code
|
|
||||||
**improve exceptions for unknown arguments
|
|
||||||
|
|
||||||
Planned for next update (The rcrypt Update):
|
Planned for next update (The Housekeeping Update Pt. 2):
|
||||||
|
|
||||||
- initial implementation of a data store for other applications (libsecret alt.)
|
- add new file list w/color and w/o extensions
|
||||||
|
- improve exceptions for unknown arguments
|
||||||
- ability to pass entries as arguments for more functions
|
- ability to pass entries as arguments for more functions
|
||||||
- manpage
|
- manpage
|
||||||
|
- add more comments to code
|
||||||
|
- simplify code from the Notetaker Update
|
||||||
|
|
||||||
|
Planned for next update (The cryptpass Update):
|
||||||
|
|
||||||
|
- initial implementation of a data store for other applications (libsecret alt.)
|
||||||
|
- modularize code in preparation for GUI frontends
|
||||||
|
|
||||||
Planned, no timeline:
|
Planned, no timeline:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user