from cryptography.hazmat.primitives.ciphers import Cipher from cryptography.hazmat.primitives.ciphers.algorithms import AES from cryptography.hazmat.primitives.ciphers.modes import CBC from cryptography.hazmat.primitives.hashes import SHA1 from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
import secretstorage
# Function to get rid of padding def clean(decrypted: bytes) -> str: last = decrypted[-1] if isinstance(last, int): return decrypted[:-last].decode("utf8") return decrypted[: -ord(last)].decode("utf8")
# 获取Chrome密钥 def find_pass(): bus = secretstorage.dbus_init() collection = secretstorage.get_default_collection(bus) for item in collection.get_all_items(): print(item.get_label(), " :", item.get_secret()) if item.get_label() == 'Chromium Safe Storage': return item.get_secret() else: raise Exception('Chrome password not found!')