Last active
October 29, 2019 10:05
-
-
Save KristobalJunta/a915e8f763e72f9882785b683fd88247 to your computer and use it in GitHub Desktop.
Decode passwords stored in HeidiSQL
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
#!/usr/bin/env python | |
from __future__ import print_function | |
import sys | |
def heidi_decode(hexstr): | |
shift = int(hexstr[-1]) | |
l = [int(hexstr[i:i+2], 16) for i in range(0, len(hexstr), 2)] | |
return ''.join(chr(v - shift) for v in l) | |
if __name__ == '__main__': | |
""" | |
Accepts encoded password either from stdin or as cli argument | |
Prints it's plaintext decoded version to stdout | |
""" | |
if len(sys.argv) < 2: | |
s = sys.stdin.readline().strip() | |
else: | |
s = sys.argv[1] | |
passwd = heidi_decode(s) | |
print(passwd) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment