Skip to content

Commit c8ee00e

Browse files
committed
cleanup pwdreader for slip-0016
1 parent 4cb852e commit c8ee00e

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

slip-0016/pwdreader.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def getFileEncKey(key):
3333
filekey, enckey = key[:len(key)/2], key[len(key)/2:]
3434
FILENAME_MESS = '5f91add3fa1c3c76e90c90a3bd0999e2bd7833d06a483fe884ee60397aca277a'
3535
digest = hmac.new(filekey, FILENAME_MESS, hashlib.sha256).hexdigest()
36-
filename = ''.join((digest, '.pswd'))
36+
filename = digest + '.pswd'
3737
return [filename, filekey, enckey]
3838

3939
# File level decryption and file reading
@@ -80,8 +80,11 @@ def getDecryptedNonce(entry):
8080
print
8181
print 'Waiting for TREZOR input ...'
8282
print
83-
title = entry['title'].replace("http://","").replace("https://","")
84-
ENC_KEY = ''.join(('Unlock ', title, ' for user ', entry['username'], '?'))
83+
if 'item' in entry:
84+
item = entry['item'].replace('http://', '').replace('https://', '')
85+
else:
86+
item = entry['title'].replace('http://', '').replace('https://', '')
87+
ENC_KEY = 'Unlock %s for user %s?' % (item, entry['username'])
8588
ENC_VALUE = entry['nonce']
8689
decrypted_nonce = hexlify(client.decrypt_keyvalue(
8790
getPath(),
@@ -118,13 +121,13 @@ def main():
118121
fileName = getFileEncKey(masterKey)[0]
119122
#print 'file name:', fileName
120123

121-
path = os.path.expanduser('~/Dropbox/Apps/TREZOR Passwords/')
124+
path = os.path.expanduser('~/Dropbox/Apps/TREZOR Password Manager/')
122125
#print 'path to file:', path
123126

124127
encKey = getFileEncKey(masterKey)[2]
125128
#print 'enckey:', encKey
126129

127-
full_path = ''.join((path, fileName))
130+
full_path = path + fileName
128131
parsed_json = decryptStorage(full_path, encKey)
129132

130133
#list entries

0 commit comments

Comments
 (0)