Further prevention of /dev/shm file retention

This commit is contained in:
2022-01-10 22:36:19 -05:00
parent e2f45c7cac
commit e00fd64c66
+5 -10
View File
@@ -329,6 +329,9 @@ def copy_data(): # copies a specified field of an entry to the clipboard
print() print()
system(f"cd {directory}; ls -1 *") # TODO replace with new list system(f"cd {directory}; ls -1 *") # TODO replace with new list
_read_entry = str(input('\nEntry to copy: ')) _read_entry = str(input('\nEntry to copy: '))
if not Path(f"{directory}{_read_entry}.gpg").is_file():
print("\nThe file does not exist!\n")
s_exit()
_shm_folder, _shm_entry = shm_gen() _shm_folder, _shm_entry = shm_gen()
system(f"gpg -d --output /dev/shm/{_shm_folder}/{_shm_entry} '{directory}{_read_entry}.gpg'") system(f"gpg -d --output /dev/shm/{_shm_folder}/{_shm_entry} '{directory}{_read_entry}.gpg'")
_copy_line = open(f"/dev/shm/{_shm_folder}/{_shm_entry}", 'r').readlines() _copy_line = open(f"/dev/shm/{_shm_folder}/{_shm_entry}", 'r').readlines()
@@ -449,22 +452,14 @@ elif argument == 'edit username' or argument == 'edit -u' or argument == 'edit p
s_exit() s_exit()
elif argument == 'gen' or argument == 'gen update' or argument == 'gen -u': elif argument == 'gen' or argument == 'gen update' or argument == 'gen -u':
try: try:
try: gen()
gen()
except FileNotFoundError:
print('\nThe file does not exist!\n')
s_exit()
except KeyboardInterrupt: except KeyboardInterrupt:
print('\n') print('\n')
s_exit() s_exit()
elif argument == 'copy username' or argument == 'copy -u' or argument == 'copy password' or argument == 'copy -p' or \ elif argument == 'copy username' or argument == 'copy -u' or argument == 'copy password' or argument == 'copy -p' or \
argument == 'copy url' or argument == 'copy -l' or argument == 'copy note' or argument == 'copy -n': argument == 'copy url' or argument == 'copy -l' or argument == 'copy note' or argument == 'copy -n':
try: try:
try: copy_data()
copy_data()
except FileNotFoundError:
print('\nThe file does not exist!\n')
s_exit()
except KeyboardInterrupt: except KeyboardInterrupt:
print('\n') print('\n')
s_exit() s_exit()