Esempio n. 1
0
# 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)
Esempio n. 2
0
# The init command for intializing the wallet or reinitializing the wallet

import coreRoutines as cr
import fileIO
import uiHelper
import openSSL

# Check whether the wallet has already been initialized
if cr.existsWallet():
	print('\nWallet already initialized\n')
	if uiHelper.askReset():
		# Get old password key
		key = openSSL.hash(uiHelper.getPassword(), '-binary')
		# Open the wallet to check that the old password is valid
		cr.openWallet(key)
		# Create a new wallet
		cr.newWallet()
else:
	cr.newWallet()
Esempio n. 3
0
# The get command for retrieving passwords from the password wallet

import coreRoutines as cr
import uiHelper
import openSSL
import re
import fileIO
import sys

# Check to make sure the wallet has been initialized
if not cr.existsWallet():
	sys.exit('\nWallet not initialized\n')
# Get password key
key = openSSL.hash(uiHelper.getPassword(), '-binary')
# Open the wallet using the key
wallet = cr.openWallet(key)
# Prompt the user for the site to retrieve
site = uiHelper.getSite()
# Search the wallet for the site,password key-value pair using a regular expression
# The regular expression looks like this: ^(site),(password)$
found = re.search(r'^(' + site + '),(.*)$', wallet, re.M)
if found:
	# Copy the password to the system clipboard
	uiHelper.addToClipboard(found.group(2))
else:
	print('Could not find ' + site + ' in your wallet')