-
-
Save brunomgalmeida/d618d276655ee3410e421800e0c59991 to your computer and use it in GitHub Desktop.
DBeaver password decryption script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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