Created
May 28, 2020 09:56
-
-
Save ixs/8711451bcbe808551ec857e7026fa77f to your computer and use it in GitHub Desktop.
Try multiple passwords to access a keepass database
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 python3 | |
# | |
# Forgot the password for my keepass library. I knew the password | |
# was based on a certain scheme that encodes the year etc. | |
# | |
# Rather than trying it out by hand, have a program do it for me. | |
# | |
# Quick and dirty... | |
# | |
import pykeepass | |
import sys | |
for i in ('foo', 'Foo'): | |
for j in (2015, 2016, 2017, 2018, 2019, 2020): | |
for k in ('bar', 'Bar'): | |
for l in ('', '%', '&', '%&', '&%'): | |
pwd = ''.join((i, str(j), k, l)) | |
try: | |
kp = pykeepass.PyKeePass('keepass.kdbx', password=pwd) | |
print('Success %s' % pwd) | |
sys.exit() | |
except pykeepass.exceptions.CredentialsIntegrityError: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment