Commit 8c0ab2b9 authored by Colomban Wendling's avatar Colomban Wendling

Try and decode the decrypted password as UTF-8

This allows for better display with Python 3, displaying the UTF-8
representation of the bytes instead of escape sequences and a confusing
surrounding `b''`
parent e1c2327c
......@@ -53,10 +53,15 @@ def pass_decrypt(p, key=PASSCRYPT_KEY, mode=DES.MODE_CFB):
if (mode in (DES.MODE_ECB, DES.MODE_CBC)) and ((len(buf) % 8) != 0 or
len(buf) > 8192):
return buf
d = buf
c =, mode=mode, IV=b'\0'*8)
d = c.decrypt(buf)
c =, mode=mode, IV=b'\0'*8)
return c.decrypt(buf)
return d.decode()
except UnicodeDecodeError:
return d
else: # raw password
return p
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment