Python скрипт для расшифровки сохраненных паролей в dbeaver.
Скорректируйте в скрипте путь до вашего файла credentials-config.json
import sys
import base64
import os
import json
import crypto
import sys
sys.modules['Crypto'] = crypto
from crypto.Cipher import AES
if len(sys.argv) < 2:
filepath = os.path.expanduser(r"C:\Users\user\AppData\Roaming\DBeaverData\workspace6\General1\.dbeaver\credentials-config.json")
else:
filepath = sys.argv[1]
# Python 3
#PASSWORD_DECRYPTION_KEY = bytes([-70, -69, 74, -97, 119, 74, -72, 83, -55, 108, 45, 101, 61, -2, 84, 74])
#PASSWORD_DECRYPTION_KEY = bytes([186, 187, 74, 159, 119, 74, 184, 83, 201, 108, 45, 101, 61, 254, 84, 74])
# Python 2
PASSWORD_DECRYPTION_KEY = bytearray([186,187,74,159,119,74,184,83,201,108,45,101,61,254,84,74])
data = open(filepath, 'rb').read()
# Python 3
decryptor = AES.new(PASSWORD_DECRYPTION_KEY, AES.MODE_CBC, data[:16])
# Python 2
#decryptor = AES.new(str(PASSWORD_DECRYPTION_KEY), AES.MODE_CBC, data[:16])
# The '-8' was observed in my case, I'm not sure it will be the same in every case
# Basically this was the string '\x08\x08\x08\x08\x08\x08\x08\x08' in the decrypted output
output = decryptor.decrypt(data[16:])[:-11]
print(output)