Skip to content

Instantly share code, notes, and snippets.

@brunomgalmeida
Forked from felipou/decrypt_dbeaver.py
Created August 6, 2020 09:09
Show Gist options
  • Save brunomgalmeida/d618d276655ee3410e421800e0c59991 to your computer and use it in GitHub Desktop.
Save brunomgalmeida/d618d276655ee3410e421800e0c59991 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