Skip to content

Instantly share code, notes, and snippets.

@lsloan
Forked from felipou/decrypt_dbeaver.py
Created August 11, 2023 02:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lsloan/898bf0e3daee9ccd5f6de1db3d83c942 to your computer and use it in GitHub Desktop.
Save lsloan/898bf0e3daee9ccd5f6de1db3d83c942 to your computer and use it in GitHub Desktop.
DBeaver password decryption script
# https://stackoverflow.com/questions/39928401/recover-db-password-stored-in-my-dbeaver-connection
import sys
import base64
print(sys.argv[1])
PASSWORD_ENCRYPTION_KEY = b"sdf@!#$verf^wv%6Fwe%$$#FFGwfsdefwfe135s$^H)dg"
data_enc = sys.argv[1]
data_bin = base64.b64decode(data_enc)
output = bytearray(b"")
for i in range(len(data_bin)):
output.append(data_bin[i] ^ PASSWORD_ENCRYPTION_KEY[i % len(PASSWORD_ENCRYPTION_KEY)])
print(output)
if output[-2] == 0 and output[-1] == 129:
print("PASSWORD:", output[:-2].decode("utf-8"))
else:
print("Error decrypting")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment