mirror of
https://github.com/rwinkhart/sshyp.git
synced 2026-09-02 07:07:18 -04:00
Updated gen command to new notes system
This commit is contained in:
@@ -303,17 +303,22 @@ def gen(): # generates a password for a new or an existing entry
|
||||
_username = str(input('Username: '))
|
||||
_pass_length = int(input('How many characters should be in the password? '))
|
||||
_pass_type = str(input('Should the password be simple (for compatibility) or complex (for security)? (s/C) '))
|
||||
if _pass_type != 's':
|
||||
_pass_type = string.ascii_letters + string.digits + string.punctuation
|
||||
if _pass_type == 's':
|
||||
if _pass_type.lower() == 's':
|
||||
_pass_type = string.ascii_letters + string.digits
|
||||
else:
|
||||
_pass_type = string.ascii_letters + string.digits + string.punctuation
|
||||
_pass_gen = ''.join(random.SystemRandom().choice(_pass_type) for _ in range(_pass_length))
|
||||
if argument != 'gen update' and argument != 'gen -u':
|
||||
_url = str(input('URL: '))
|
||||
_notes = str(input('Additional notes: ')) # TODO update w/new notes system
|
||||
_add_note = input('Add a note to this entry? (y/N) ')
|
||||
_shm_folder, _shm_entry = shm_gen()
|
||||
open(f"/dev/shm/{_shm_folder}/{_shm_entry}", 'w').writelines(_username + '\n' + _pass_gen + '\n' + _url +
|
||||
'\n\n' + _notes + '\n\n')
|
||||
if _add_note.lower() == 'y':
|
||||
system(f"nano /dev/shm/{_shm_folder}/{_shm_entry}-n")
|
||||
_notes = open(f"/dev/shm/{_shm_folder}/{_shm_entry}-n", 'r').read()
|
||||
else:
|
||||
_notes = ''
|
||||
open(f"/dev/shm/{_shm_folder}/{_shm_entry}", 'w').writelines(_username + '\n' + _pass_gen + '\n' + _url + '\n\n'
|
||||
+ _notes + '\n\n')
|
||||
encrypt(_shm_folder, _shm_entry, _entry_name)
|
||||
system(f"gpg -d '{directory}{_entry_name}.gpg'")
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user