feat: renamed Crx to crx. Added proxy support. Minor code improvements.
This commit is contained in:
28
crx/keepassplugin.py
Normal file
28
crx/keepassplugin.py
Normal file
@@ -0,0 +1,28 @@
|
||||
import sys
|
||||
import gzip
|
||||
import base64
|
||||
from lxml import etree
|
||||
|
||||
if sys.platform == 'win32':
|
||||
iswin = True
|
||||
import win32crypt
|
||||
else:
|
||||
iswin = False
|
||||
win32crypt = None
|
||||
|
||||
|
||||
ADDITIONAL_ENTROPY = b'\xf8\x03\xfaQ\x87\x18I]'
|
||||
PREFIX = 'data:application/vnd.KeePass.Entries-E;base64,'
|
||||
|
||||
|
||||
def parse_keepass_entry(data: str):
|
||||
if not data.startswith(PREFIX):
|
||||
raise ValueError("Not a valid entry")
|
||||
|
||||
data = base64.b64decode(data.split(','[1]))
|
||||
|
||||
if iswin:
|
||||
data = win32crypt.CryptUnprotectData(data, ADDITIONAL_ENTROPY)
|
||||
|
||||
data = gzip.decompress(data)
|
||||
return data.decode() # XML String
|
||||
Reference in New Issue
Block a user