-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathput.py
More file actions
executable file
·25 lines (23 loc) · 837 Bytes
/
Copy pathput.py
File metadata and controls
executable file
·25 lines (23 loc) · 837 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# The put command for adding new sites to the password wallet
import coreRoutines as cr
import uiHelper
import openSSL
import fileIO
import sys
# Check to make sure the wallet has been initialized
if not cr.existsWallet():
sys.exit('\nWallet not initialized\n')
# Prompts the user for the master password and hashes it into the encryption key
key = openSSL.hash(uiHelper.getPassword(), '-binary')
# Open the wallet using the key
wallet = cr.openWallet(key)
# Prompt the user for the site to add
site = uiHelper.getSite()
# Generate a new password for this site
newPassword = openSSL.generatePassword()
# Append the password to the wallet
wallet = wallet + site + ',' + newPassword
# Write the change to the wallet using the key
cr.closeWallet(key, wallet)
# Copy the new password to the clipboard
uiHelper.addToClipboard(newPassword)